[6997] Fixed: In 3.0.3 spell data have area group id instead area id.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
GriffonHeart 2009-01-01 22:40:52 +03:00 committed by VladimirMangos
parent f6bd9ef67a
commit 2441c2a69f
10 changed files with 46 additions and 26 deletions

View file

@ -246,9 +246,6 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
case SPELL_FAILED_REQUIRES_SPELL_FOCUS: case SPELL_FAILED_REQUIRES_SPELL_FOCUS:
data << uint32(spellInfo->RequiresSpellFocus); data << uint32(spellInfo->RequiresSpellFocus);
break; break;
case SPELL_FAILED_REQUIRES_AREA:
data << uint32(spellInfo->AreaId);
break;
} }
SendPacket(&data); SendPacket(&data);
} }

View file

@ -18671,7 +18671,7 @@ void Player::UpdateAreaDependentAuras( uint32 newArea )
for(AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end();) 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 // use m_zoneUpdateId for speed: UpdateArea called from UpdateZone or instead UpdateZone in both cases m_zoneUpdateId up-to-date
if(!IsSpellAllowedInLocation(iter->second->GetSpellProto(),GetMapId(),m_zoneUpdateId,newArea)) if(GetSpellAllowedInLocationError(iter->second->GetSpellProto(),GetMapId(),m_zoneUpdateId,newArea)!=0)
RemoveAura(iter); RemoveAura(iter);
else else
++iter; ++iter;

View file

@ -2713,8 +2713,8 @@ void Spell::SendCastResult(uint8 result)
case 45373: // Bloodberry Elixir case 45373: // Bloodberry Elixir
data << uint32(4075); data << uint32(4075);
break; break;
default: // default case default: // default case (don't must be)
data << uint32(m_spellInfo->AreaId); data << uint32(0);
break; break;
} }
break; break;
@ -3652,8 +3652,8 @@ uint8 Spell::CanCast(bool strict)
return SPELL_FAILED_NOT_IN_ARENA; return SPELL_FAILED_NOT_IN_ARENA;
// zone check // zone check
if(!IsSpellAllowedInLocation(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()))
return SPELL_FAILED_REQUIRES_AREA; return res;
// not let players cast spells at mount (and let do it to creatures) // not let players cast spells at mount (and let do it to creatures)
if( m_caster->IsMounted() && m_caster->GetTypeId()==TYPEID_PLAYER && !m_IsTriggeredSpell && if( m_caster->IsMounted() && m_caster->GetTypeId()==TYPEID_PLAYER && !m_IsTriggeredSpell &&
@ -4279,7 +4279,7 @@ uint8 Spell::CanCast(bool strict)
return SPELL_FAILED_NO_MOUNTS_ALLOWED; return SPELL_FAILED_NO_MOUNTS_ALLOWED;
// Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells // Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells
if (m_caster->GetTypeId()==TYPEID_PLAYER && !sMapStore.LookupEntry(m_caster->GetMapId())->IsMountAllowed() && !m_IsTriggeredSpell && !m_spellInfo->AreaId) if (m_caster->GetTypeId()==TYPEID_PLAYER && !sMapStore.LookupEntry(m_caster->GetMapId())->IsMountAllowed() && !m_IsTriggeredSpell && !m_spellInfo->AreaGroupId)
return SPELL_FAILED_NO_MOUNTS_ALLOWED; return SPELL_FAILED_NO_MOUNTS_ALLOWED;
ShapeshiftForm form = m_caster->m_form; ShapeshiftForm form = m_caster->m_form;

View file

@ -2257,11 +2257,24 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg)
return true; return true;
} }
bool IsSpellAllowedInLocation(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)
{ {
// normal case // normal case
if( spellInfo->AreaId > 0 && spellInfo->AreaId != zone_id && spellInfo->AreaId != area_id ) if( spellInfo->AreaGroupId > 0)
return false; {
bool found = false;
AreaGroupEntry const* groupEntry = sAreaGroupStore.LookupEntry(spellInfo->AreaGroupId);
if(groupEntry)
{
for (uint8 i=0; i<7; i++)
if( groupEntry->AreaId[i] == zone_id || groupEntry->AreaId[i] == area_id )
found = true;
}
if(!found)
return SPELL_FAILED_INCORRECT_AREA;
}
// elixirs (all area dependent elixirs have family SPELLFAMILY_POTION, use this for speedup) // elixirs (all area dependent elixirs have family SPELLFAMILY_POTION, use this for speedup)
if(spellInfo->SpellFamilyName==SPELLFAMILY_POTION) if(spellInfo->SpellFamilyName==SPELLFAMILY_POTION)
@ -2271,24 +2284,24 @@ bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 z
if(mask & ELIXIR_BATTLE_MASK) if(mask & ELIXIR_BATTLE_MASK)
{ {
if(spellInfo->Id==45373) // Bloodberry Elixir if(spellInfo->Id==45373) // Bloodberry Elixir
return zone_id==4075; return zone_id==4075 ? 0 : SPELL_FAILED_REQUIRES_AREA;
} }
if(mask & ELIXIR_UNSTABLE_MASK) if(mask & ELIXIR_UNSTABLE_MASK)
{ {
// in the Blade's Edge Mountains Plateaus and Gruul's Lair. // in the Blade's Edge Mountains Plateaus and Gruul's Lair.
return zone_id ==3522 || map_id==565; return zone_id ==3522 || map_id==565 ? 0 : SPELL_FAILED_INCORRECT_AREA;
} }
if(mask & ELIXIR_SHATTRATH_MASK) if(mask & ELIXIR_SHATTRATH_MASK)
{ {
// in Tempest Keep, Serpentshrine Cavern, Caverns of Time: Mount Hyjal, Black Temple, Sunwell Plateau // in Tempest Keep, Serpentshrine Cavern, Caverns of Time: Mount Hyjal, Black Temple, Sunwell Plateau
if(zone_id ==3607 || map_id==534 || map_id==564 || zone_id==4075) if(zone_id ==3607 || map_id==534 || map_id==564 || zone_id==4075)
return true; return 0;
MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
if(!mapEntry) if(!mapEntry)
return false; return SPELL_FAILED_INCORRECT_AREA;
return mapEntry->multimap_id==206; return mapEntry->multimap_id==206 ? 0 : SPELL_FAILED_INCORRECT_AREA;
} }
// elixirs not have another limitations // elixirs not have another limitations
@ -2304,25 +2317,25 @@ bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 z
{ {
MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
if(!mapEntry) if(!mapEntry)
return false; return SPELL_FAILED_INCORRECT_AREA;
return mapEntry->multimap_id==206; return mapEntry->multimap_id==206 ? 0 : SPELL_FAILED_REQUIRES_AREA;
} }
case 41617: // Cenarion Mana Salve case 41617: // Cenarion Mana Salve
case 41619: // Cenarion Healing Salve case 41619: // Cenarion Healing Salve
{ {
MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
if(!mapEntry) if(!mapEntry)
return false; return SPELL_FAILED_INCORRECT_AREA;
return mapEntry->multimap_id==207; return mapEntry->multimap_id==207 ? 0 : SPELL_FAILED_REQUIRES_AREA;
} }
case 40216: // Dragonmaw Illusion case 40216: // Dragonmaw Illusion
case 42016: // Dragonmaw Illusion case 42016: // Dragonmaw Illusion
return area_id == 3759 || area_id == 3966 || area_id == 3939; return area_id == 3759 || area_id == 3966 || area_id == 3939 ? 0 : SPELL_FAILED_INCORRECT_AREA;
} }
return true; return 0;
} }
void SpellMgr::LoadSkillLineAbilityMap() void SpellMgr::LoadSkillLineAbilityMap()

View file

@ -351,7 +351,7 @@ bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellI
bool IsAuraAddedBySpell(uint32 auraType, uint32 spellId); bool IsAuraAddedBySpell(uint32 auraType, uint32 spellId);
bool IsSpellAllowedInLocation(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);
inline bool IsAreaEffectTarget( Targets target ) inline bool IsAreaEffectTarget( Targets target )
{ {

View file

@ -30,6 +30,7 @@ typedef std::map<uint16,uint32> AreaFlagByAreaID;
typedef std::map<uint32,uint32> AreaFlagByMapID; typedef std::map<uint32,uint32> AreaFlagByMapID;
DBCStorage <AreaTableEntry> sAreaStore(AreaTableEntryfmt); DBCStorage <AreaTableEntry> sAreaStore(AreaTableEntryfmt);
DBCStorage <AreaGroupEntry> sAreaGroupStore(AreaGroupEntryfmt);
static AreaFlagByAreaID sAreaFlagByAreaID; static AreaFlagByAreaID sAreaFlagByAreaID;
static AreaFlagByMapID sAreaFlagByMapID; // for instances without generated *.map files static AreaFlagByMapID sAreaFlagByMapID; // for instances without generated *.map files
@ -215,6 +216,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAchievementStore, dbcPath,"Achievement.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAchievementStore, dbcPath,"Achievement.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAchievementCriteriaStore, dbcPath,"Achievement_Criteria.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAchievementCriteriaStore, dbcPath,"Achievement_Criteria.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAreaTriggerStore, dbcPath,"AreaTrigger.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAreaTriggerStore, dbcPath,"AreaTrigger.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAreaGroupStore, dbcPath,"AreaGroup.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBankBagSlotPricesStore, dbcPath,"BankBagSlotPrices.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBankBagSlotPricesStore, dbcPath,"BankBagSlotPrices.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBattlemasterListStore, dbcPath,"BattlemasterList.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBattlemasterListStore, dbcPath,"BattlemasterList.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBarberShopStyleStore, dbcPath,"BarberShopStyle.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBarberShopStyleStore, dbcPath,"BarberShopStyle.dbc");

View file

@ -133,6 +133,7 @@ class DBCStorage
extern DBCStorage <AchievementEntry> sAchievementStore; extern DBCStorage <AchievementEntry> sAchievementStore;
extern DBCStorage <AchievementCriteriaEntry> sAchievementCriteriaStore; extern DBCStorage <AchievementCriteriaEntry> sAchievementCriteriaStore;
extern DBCStorage <AreaTableEntry> sAreaStore;// recommend access using functions extern DBCStorage <AreaTableEntry> sAreaStore;// recommend access using functions
extern DBCStorage <AreaGroupEntry> sAreaGroupStore;
extern DBCStorage <AreaTriggerEntry> sAreaTriggerStore; extern DBCStorage <AreaTriggerEntry> sAreaTriggerStore;
extern DBCStorage <BankBagSlotPricesEntry> sBankBagSlotPricesStore; extern DBCStorage <BankBagSlotPricesEntry> sBankBagSlotPricesStore;
extern DBCStorage <BarberShopStyleEntry> sBarberShopStyleStore; extern DBCStorage <BarberShopStyleEntry> sBarberShopStyleStore;

View file

@ -485,6 +485,12 @@ struct AreaTableEntry
uint32 team; // 28 uint32 team; // 28
}; };
struct AreaGroupEntry
{
uint32 AreaGroupId; // 0
uint32 AreaId[7]; // 1-7
};
struct AreaTriggerEntry struct AreaTriggerEntry
{ {
uint32 id; // 0 m_ID uint32 id; // 0 m_ID
@ -1152,7 +1158,7 @@ struct SpellEntry
//uint32 MinReputation; // 223 m_minReputation not used //uint32 MinReputation; // 223 m_minReputation not used
//uint32 RequiredAuraVision; // 224 m_requiredAuraVision not used //uint32 RequiredAuraVision; // 224 m_requiredAuraVision not used
uint32 TotemCategory[2]; // 225-226 m_requiredTotemCategoryID uint32 TotemCategory[2]; // 225-226 m_requiredTotemCategoryID
int32 AreaId; // 227 m_requiredAreasID int32 AreaGroupId; // 227 m_requiredAreaGroupId
uint32 SchoolMask; // 228 m_schoolMask uint32 SchoolMask; // 228 m_schoolMask
uint32 runeCostID; // 229 m_runeCostID uint32 runeCostID; // 229 m_runeCostID
//uint32 spellMissileID; // 230 m_spellMissileID not used //uint32 spellMissileID; // 230 m_spellMissileID not used

View file

@ -19,6 +19,7 @@
const char Achievementfmt[]="niixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxxxxxxxxxi"; const char Achievementfmt[]="niixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxxxxxxxxxi";
const char AchievementCriteriafmt[]="niiiiiiiixxxxxxxxxxxxxxxxxiixix"; const char AchievementCriteriafmt[]="niiiiiiiixxxxxxxxxxxxxxxxxiixix";
const char AreaTableEntryfmt[]="iiinixxxxxissssssssssssssssxixxxxxxx"; const char AreaTableEntryfmt[]="iiinixxxxxissssssssssssssssxixxxxxxx";
const char AreaGroupEntryfmt[]="niiiiiii";
const char AreaTriggerEntryfmt[]="niffffffff"; const char AreaTriggerEntryfmt[]="niffffffff";
const char BankBagSlotPricesEntryfmt[]="ni"; const char BankBagSlotPricesEntryfmt[]="ni";
const char BarberShopStyleEntryfmt[]="nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiii"; const char BarberShopStyleEntryfmt[]="nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiii";

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 "6996" #define REVISION_NR "6997"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__