mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Scripts/Maps: ported WorldMapScript database implementation and ported Deeprun Tram script and removed unnecessary parts from it.
*thx to Annakin?
This commit is contained in:
14
sql/updates/world/custom/custom_2018_11_21_00_world.sql
Normal file
14
sql/updates/world/custom/custom_2018_11_21_00_world.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
DROP TABLE IF EXISTS `world_map_template`;
|
||||
CREATE TABLE `world_map_template`(
|
||||
`mapID` INT(11) UNSIGNED NOT NULL DEFAULT '0' ,
|
||||
`ScriptName` TEXT,
|
||||
PRIMARY KEY (`mapID`));
|
||||
|
||||
DELETE FROM `world_map_template` WHERE `mapId`= 369;
|
||||
INSERT INTO `world_map_template` (`mapID`, `ScriptName`) VALUES
|
||||
(369, 'world_map_deeprun_tram');
|
||||
|
||||
DELETE FROM `gameobject` WHERE `guid` IN (18802, 18803, 18804, 18805, 18806, 18807);
|
||||
DELETE FROM `gameobject_addon` WHERE `guid` IN (18802, 18803, 18804, 18805, 18806, 18807);
|
||||
|
||||
UPDATE `gameobject_template` SET `data6`= 0, `data8`= 0, `data10`= 0 WHERE `entry`= 176084;
|
||||
@@ -9377,6 +9377,8 @@ void ObjectMgr::LoadScriptNames()
|
||||
"UNION "
|
||||
"SELECT DISTINCT(ScriptName) FROM outdoorpvp_template WHERE ScriptName <> '' "
|
||||
"UNION "
|
||||
"SELECT DISTINCT(ScriptName) FROM world_map_template WHERE ScriptName <> '' "
|
||||
"UNION "
|
||||
"SELECT DISTINCT(script) FROM instance_template WHERE script <> ''");
|
||||
|
||||
if (!result)
|
||||
|
||||
@@ -102,6 +102,10 @@ template<>
|
||||
struct is_script_database_bound<AchievementCriteriaScript>
|
||||
: std::true_type { };
|
||||
|
||||
template<>
|
||||
struct is_script_database_bound<WorldMapScript>
|
||||
: std::true_type { };
|
||||
|
||||
enum Spells
|
||||
{
|
||||
SPELL_HOTSWAP_VISUAL_SPELL_EFFECT = 40162 // 59084
|
||||
|
||||
90
src/server/scripts/World/world_map_scripts.cpp
Normal file
90
src/server/scripts/World/world_map_scripts.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Transport.h"
|
||||
#include "ObjectMgr.h"
|
||||
|
||||
enum DeeprunTram
|
||||
{
|
||||
MAP_DEEPRUN_TRAM = 369,
|
||||
|
||||
GO_SUBWAY = 176080,
|
||||
MAX_SUBWAY_COUNT = 6
|
||||
};
|
||||
|
||||
Position const SubwaysPos[MAX_SUBWAY_COUNT] =
|
||||
{
|
||||
{ 4.580650f, 28.20970f, 7.01107f, 1.5708f },
|
||||
{ 4.528070f, 8.435290f, 7.01107f, 1.5708f },
|
||||
{ -45.4005f, 2492.790f, 6.98860f, 1.5708f },
|
||||
{ -45.4007f, 2512.150f, 6.98860f, 1.5708f },
|
||||
{ -45.3934f, 2472.930f, 6.98860f, 1.5708f },
|
||||
{ 4.498830f, -11.3475f, 7.01107f, 1.5708f }
|
||||
};
|
||||
|
||||
static QuaternionData worldRotation = QuaternionData(0.0f, 0.0f, 0.7071066f, 0.7071069f);
|
||||
static QuaternionData parentRotation = QuaternionData(0.0f, 0.0f, 1.0f, -0.0000000437114f);
|
||||
|
||||
class world_map_deeprun_tram: public WorldMapScript
|
||||
{
|
||||
public:
|
||||
world_map_deeprun_tram() : WorldMapScript("world_map_deeprun_tram", MAP_DEEPRUN_TRAM)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
_initializedTrams = false;
|
||||
}
|
||||
|
||||
void OnPlayerEnter(Map* map, Player* /*player*/) override
|
||||
{
|
||||
if (!_initializedTrams)
|
||||
{
|
||||
_initializedTrams = true;
|
||||
|
||||
for (uint8 i = 0; i < MAX_SUBWAY_COUNT; ++i)
|
||||
{
|
||||
GameObject* transport = new Transport();
|
||||
|
||||
if (!transport->Create(map->GenerateLowGuid<HighGuid::Transport>(), GO_SUBWAY + i, map, 0, SubwaysPos[i], worldRotation, 255, GO_STATE_READY))
|
||||
{
|
||||
delete transport;
|
||||
continue;
|
||||
}
|
||||
|
||||
transport->SetParentRotation(parentRotation);
|
||||
|
||||
uint32 spawnId = sObjectMgr->GenerateGameObjectSpawnId();
|
||||
transport->SetSpawnId(spawnId);
|
||||
|
||||
transport->setActive(true);
|
||||
transport->SetFarVisible(true);
|
||||
map->AddToMap(transport);
|
||||
}
|
||||
}
|
||||
}
|
||||
private:
|
||||
bool _initializedTrams;
|
||||
};
|
||||
|
||||
void AddSC_world_map_scripts()
|
||||
{
|
||||
new world_map_deeprun_tram();
|
||||
}
|
||||
@@ -31,6 +31,7 @@ void AddSC_npcs_special();
|
||||
void AddSC_achievement_scripts();
|
||||
void AddSC_action_ip_logger();
|
||||
void AddSC_duel_reset();
|
||||
void AddSC_world_map_scripts();
|
||||
// player
|
||||
void AddSC_chat_log();
|
||||
void AddSC_action_ip_logger();
|
||||
@@ -49,6 +50,7 @@ void AddWorldScripts()
|
||||
AddSC_npc_innkeeper();
|
||||
AddSC_npcs_special();
|
||||
AddSC_achievement_scripts();
|
||||
AddSC_world_map_scripts();
|
||||
AddSC_chat_log(); // location: scripts\World\chat_log.cpp
|
||||
|
||||
// FIXME: This should be moved in a script validation hook.
|
||||
|
||||
Reference in New Issue
Block a user