diff --git a/sql/base/mangos.sql b/sql/base/mangos.sql index f8d45b09fc..8d15f10e36 100644 --- a/sql/base/mangos.sql +++ b/sql/base/mangos.sql @@ -2,7 +2,7 @@ -- -- Host: localhost Database: mangos -- ------------------------------------------------------ --- Server version 5.5.32 +-- Server version 5.5.32 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) DEFAULT NULL, `creature_ai_version` varchar(120) DEFAULT NULL, `cache_id` int(10) DEFAULT '0', - `required_12951_01_mangos_item_template` bit(1) DEFAULT NULL + `required_12952_01_mangos_instance_template` bit(1) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Used DB version notes'; -- @@ -2134,6 +2134,7 @@ CREATE TABLE `instance_template` ( `levelMin` tinyint(3) unsigned NOT NULL DEFAULT '0', `levelMax` tinyint(3) unsigned NOT NULL DEFAULT '0', `ScriptName` varchar(128) NOT NULL DEFAULT '', + `mountAllowed` tinyint(3) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`map`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -2143,6 +2144,113 @@ CREATE TABLE `instance_template` ( LOCK TABLES `instance_template` WRITE; /*!40000 ALTER TABLE `instance_template` DISABLE KEYS */; +INSERT INTO `instance_template` (`map`, `parent`, `levelMin`, `levelMax`, `ScriptName`, `mountAllowed`) VALUES +(30, 0, 10, 0, '', 0), +(33, 0, 10, 0, '', 0), +(34, 0, 15, 0, '', 0), +(36, 0, 10, 0, '', 1), +(43, 0, 10, 0, '', 0), +(44, 0, 1, 0, '', 0), +(47, 0, 15, 0, '', 0), +(48, 0, 10, 0, '', 0), +(70, 0, 30, 0, '', 0), +(90, 0, 15, 0, '', 0), +(109, 0, 35, 0, '', 0), +(129, 0, 25, 0, '', 0), +(169, 0, 1, 0, '', 0), +(189, 0, 20, 0, '', 0), +(209, 0, 35, 0, '', 1), +(229, 0, 45, 0, '', 0), +(230, 0, 40, 0, '', 0), +(249, 0, 80, 0, '', 0), +(269, 0, 66, 0, '', 1), +(289, 0, 45, 0, '', 0), +(309, 0, 50, 0, '', 1), +(329, 0, 45, 0, '', 0), +(349, 0, 30, 0, '', 0), +(389, 0, 8, 0, '', 0), +(409, 0, 50, 0, '', 0), +(429, 0, 45, 0, '', 0), +(469, 0, 60, 0, '', 0), +(489, 0, 10, 0, '', 0), +(509, 0, 60, 0, '', 1), +(529, 0, 10, 0, '', 0), +(531, 0, 60, 0, '', 0), +(532, 0, 68, 0, '', 0), +(533, 0, 80, 0, '', 0), +(534, 0, 70, 0, '', 1), +(540, 0, 55, 0, '', 0), +(542, 0, 55, 0, '', 0), +(543, 0, 55, 0, '', 0), +(544, 0, 65, 0, '', 0), +(545, 0, 55, 0, '', 0), +(546, 0, 55, 0, '', 0), +(547, 0, 55, 0, '', 0), +(548, 0, 70, 0, '', 0), +(550, 0, 70, 0, '', 0), +(552, 0, 68, 0, '', 0), +(553, 0, 68, 0, '', 0), +(554, 0, 68, 0, '', 0), +(555, 0, 65, 0, '', 0), +(556, 0, 55, 0, '', 0), +(557, 0, 55, 0, '', 0), +(558, 0, 55, 0, '', 0), +(559, 0, 10, 0, '', 0), +(560, 0, 66, 0, '', 1), +(562, 0, 10, 0, '', 0), +(564, 0, 70, 0, '', 1), +(565, 0, 65, 0, '', 0), +(566, 0, 10, 0, '', 0), +(568, 0, 70, 0, '', 1), +(572, 0, 10, 0, '', 0), +(574, 0, 70, 72, '', 0), +(575, 0, 80, 80, '', 0), +(576, 0, 70, 72, '', 0), +(578, 0, 80, 80, '', 1), +(580, 0, 70, 0, '', 1), +(585, 0, 70, 0, '', 0), +(595, 0, 74, 80, '', 1), +(598, 0, 0, 0, '', 0), +(599, 0, 70, 0, '', 0), +(600, 0, 70, 0, '', 0), +(601, 0, 80, 80, '', 0), +(602, 0, 70, 0, '', 0), +(603, 0, 80, 0, '', 1), +(604, 0, 71, 80, '', 0), +(607, 0, 71, 0, '', 0), +(608, 0, 70, 80, '', 0), +(615, 0, 80, 0, '', 1), +(616, 0, 80, 0, '', 1), +(617, 0, 80, 80, '', 0), +(618, 0, 80, 80, '', 0), +(619, 0, 68, 80, '', 0), +(624, 0, 80, 0, '', 0), +(631, 0, 80, 0, '', 1), +(632, 0, 75, 0, '', 0), +(649, 0, 80, 0, '', 0), +(650, 0, 75, 0, '', 0), +(658, 0, 75, 0, '', 1), +(668, 0, 75, 0, '', 0), +(724, 0, 80, 80, '', 1), +(643, 0, 77, 0, '', 0), +(644, 0, 83, 0, '', 1), +(645, 0, 77, 0, '', 0), +(657, 0, 80, 0, '', 0), +(669, 0, 85, 0, '', 0), +(670, 0, 83, 0, '', 0), +(671, 0, 85, 0, '', 0), +(720, 0, 85, 0, '', 1), +(721, 0, 85, 0, '', 1), +(725, 0, 80, 0, '', 0), +(734, 0, 80, 0, '', 1), +(754, 0, 85, 0, '', 0), +(755, 0, 83, 0, '', 1), +(757, 0, 85, 0, '', 0), +(859, 0, 85, 0, '', 1), +(938, 0, 85, 0, '', 1), +(939, 0, 85, 0, '', 1), +(940, 0, 85, 0, '', 1), +(967, 0, 85, 0, '', 1); /*!40000 ALTER TABLE `instance_template` ENABLE KEYS */; UNLOCK TABLES; diff --git a/sql/updates/mangos/12952_01_mangos_instance_template.sql b/sql/updates/mangos/12952_01_mangos_instance_template.sql new file mode 100644 index 0000000000..ede3ad8fff --- /dev/null +++ b/sql/updates/mangos/12952_01_mangos_instance_template.sql @@ -0,0 +1,9 @@ +ALTER TABLE db_version CHANGE COLUMN required_12951_01_mangos_item_template required_12952_01_mangos_instance_template bit; + +ALTER TABLE instance_template +ADD COLUMN mountAllowed tinyint(3) UNSIGNED NOT NULL DEFAULT 0 AFTER ScriptName; + +UPDATE instance_template SET mountAllowed = 1 WHERE map IN +( + 36, 209, 269, 309, 509, 534, 560, 564, 568, 578, 580, 595, 603, 615, 616, 631, 644, 658, 720, 721, 724, 734, 755, 859, 938, 939, 940, 967 +); diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 585e3f9cfb..09913c484c 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1378,20 +1378,6 @@ struct MapEntry bool IsBattleArena() const { return map_type == MAP_ARENA; } bool IsBattleGroundOrArena() const { return map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; } - bool IsMountAllowed() const - { - return !IsDungeon() || - MapID==209 || MapID==269 || MapID==309 || // TanarisInstance, CavernsOfTime, Zul'gurub - MapID==509 || MapID==534 || MapID==560 || // AhnQiraj, HyjalPast, HillsbradPast - MapID==564 || MapID==568 || MapID==580 || // Black Temple, ZulAman, Sunwell Plateau, - MapID==595 || MapID==603 || MapID==615 || // Ulduar, The Obsidian Sanctum, Culling of Stratholme - MapID==616 || MapID==631 || MapID==658 || // Icecrown Citadel, Pit of Saron, The Eye Of Eternity - MapID==724 || MapID==644 || MapID==720 || // Halls of Origination, Ruby Sanctum, Firelands - MapID==721 || MapID==734 || MapID==755 || // Ahn'Qiraj Terrace, Lost City of Tol'Vir, Firelands - MapID==859 || MapID==938 || MapID==939 || // End Time, Well of Eternity, Zul'Gurub - MapID==940 || MapID==967; // Dragon SoulHour of Twilight - } - bool IsContinent() const { return MapID == 0 || MapID == 1 || MapID == 530 || MapID == 571; diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 65c0dd513a..91e1c49c82 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -2284,3 +2284,14 @@ bool Map::GetReachableRandomPosition(Unit* unit, float& x, float& y, float& z, f return false; } + +bool Map::IsMountAllowed() const +{ + if (!IsDungeon()) + return true; + + if (InstanceTemplate const* data = ObjectMgr::GetInstanceTemplate(GetId())) + return data->mountAllowed; + + return true; +} diff --git a/src/game/Map.h b/src/game/Map.h index 409cf559ac..446ab699ca 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -64,10 +64,11 @@ struct InstanceTemplate { uint32 map; // instance map uint32 parent; // non-continent parent instance (for instance with entrance in another instances) - // or 0 (not related to continent 0 map id) + // or 0 (not related to continent 0 map id) uint32 levelMin; uint32 levelMax; uint32 script_id; + bool mountAllowed; }; struct WorldTemplate @@ -192,6 +193,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager bool IsBattleArena() const { return i_mapEntry && i_mapEntry->IsBattleArena(); } bool IsBattleGroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattleGroundOrArena(); } bool IsContinent() const { return i_mapEntry && i_mapEntry->IsContinent(); } + bool IsMountAllowed() const; // can't be nullptr for loaded map MapPersistentState* GetPersistentState() const { return m_persistentState; } diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index e5b225188c..bbf0dc47bb 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -183,7 +183,6 @@ void WorldSession::HandleMoveWorldportAckOpcode() } } } - } // mount allow check if (!mEntry->IsMountAllowed()) diff --git a/src/game/SQLStorages.cpp b/src/game/SQLStorages.cpp index b24b33d472..e7034c35c2 100644 --- a/src/game/SQLStorages.cpp +++ b/src/game/SQLStorages.cpp @@ -30,8 +30,8 @@ const char GameObjectInfodstfmt[] = "iiissssiiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii const char ItemPrototypesrcfmt[] = "iiiisiiiiffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiifiiisiifiiiii"; const char ItemPrototypedstfmt[] = "iiiisiiiiffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiifiiiiiifiiiii"; const char PageTextfmt[] = "isi"; -const char InstanceTemplatesrcfmt[] = "iiiis"; -const char InstanceTemplatedstfmt[] = "iiiii"; +const char InstanceTemplatesrcfmt[] = "iiiisl"; +const char InstanceTemplatedstfmt[] = "iiiiil"; const char WorldTemplatesrcfmt[] = "is"; const char WorldTemplatedstfmt[] = "ii"; const char ConditionsSrcFmt[] = "iiii"; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index b134db54bb..e405d6dccb 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -6517,8 +6517,13 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_NOT_HERE; // 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->GetAreaGroupId()) + if (m_caster->GetTypeId() == TYPEID_PLAYER && + !m_IsTriggeredSpell && + !m_spellInfo->GetAreaGroupId() && + (m_caster->GetMap() && !m_caster->GetMap()->IsMountAllowed())) + { return SPELL_FAILED_NO_MOUNTS_ALLOWED; + } if (m_caster->IsInDisallowedMountForm()) return SPELL_FAILED_NOT_SHAPESHIFT; diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 8b8336c36f..b3965103a9 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -2,5 +2,5 @@ #define __REVISION_SQL_H__ #define REVISION_DB_REALMD "required_c12484_02_realmd_account_access" #define REVISION_DB_CHARACTERS "required_12949_01_characters_mangle_cleanup" - #define REVISION_DB_MANGOS "required_12951_01_mangos_item_template" + #define REVISION_DB_MANGOS "required_12952_01_mangos_instance_template" #endif // __REVISION_SQL_H__