From 51f5ce1b7364b730cb0bdabcfd6ad18794213f95 Mon Sep 17 00:00:00 2001 From: Aokromes Date: Thu, 1 Jan 2015 18:41:17 +0100 Subject: [PATCH 01/33] DB/Gameobject: Fix Karazhan opera event game objects By lassdas, closes #13832 --- sql/updates/world/2015_01_01_00_world.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 sql/updates/world/2015_01_01_00_world.sql diff --git a/sql/updates/world/2015_01_01_00_world.sql b/sql/updates/world/2015_01_01_00_world.sql new file mode 100644 index 0000000000..3d78439fed --- /dev/null +++ b/sql/updates/world/2015_01_01_00_world.sql @@ -0,0 +1,3 @@ +-- Fix Karazhan opera event game objects +-- Interaction fix => Disable player interaction with Door and Curtain +UPDATE `gameobject_template` SET `flags` = 16 WHERE `entry` IN (184278,184279,183932); From 3ea97450aec21619b953753430750e0b4ec92920 Mon Sep 17 00:00:00 2001 From: Nayd Date: Mon, 5 Jan 2015 16:13:24 +0000 Subject: [PATCH 02/33] Update README.md Dead links for installation. (cherry picked from commit ac67f276ceaa517801b6abc9f0edc30d7e8ce604) Closes #13858 --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 71c78873b0..263339fc9d 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,8 @@ website at [TrinityCore.org](http://www.trinitycore.org). ## Install -Detailed installation guides are available in the wiki for -[Windows](http://collab.kpsn.org/display/tc/Win), -[Linux](http://collab.kpsn.org/display/tc/Linux) and -[Mac OSX](http://collab.kpsn.org/display/tc/Mac). +Detailed installation guides are available in the [wiki](http://collab.kpsn.org/display/tc/Installation+Guide) for +Windows, Linux and Mac OSX. ## Reporting issues From 253dc0f99e8321a126ab32594b2023b176b86705 Mon Sep 17 00:00:00 2001 From: Dr-J Date: Wed, 7 Jan 2015 20:31:13 +0000 Subject: [PATCH 03/33] DB/Misc: Revert a few factions Revert faction of Alliance Corpse and Forsaken Corpse to 35 as this is what it is in sniff not 1899/1900 and this was making these "corpse" npcs attack players and other npcs. Closes #13865 Revert faction of Lord Banehollow since with faction 90 using the Shadowy Potion which should make him friendly to turn in quest of npc name into him but with faction 90 remains hostile even after drinking shadowy potion, this works as should with the original faction of 1434. --- sql/updates/world/2015_01_07_00_world.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 sql/updates/world/2015_01_07_00_world.sql diff --git a/sql/updates/world/2015_01_07_00_world.sql b/sql/updates/world/2015_01_07_00_world.sql new file mode 100644 index 0000000000..3cf6056964 --- /dev/null +++ b/sql/updates/world/2015_01_07_00_world.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `faction`=35 WHERE `entry`IN(24009,24010); +UPDATE `creature_template` SET `faction`=1434 WHERE `entry`=9516; From 9ea93eae33dcf776537a41e9c9ff33a31d6e3e19 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Wed, 7 Jan 2015 22:48:34 +0100 Subject: [PATCH 04/33] Core/Aura: Replace assert with logged error for invalid AuraRemoveMode Fix AuraScript::Remove() triggering an assert with default parameter and log an error when Aura is removed with invalid mode AURA_REMOVE_NONE instead of triggering an assert deep down in the call tree. Fix https://github.com/TrinityCore/TrinityCore/issues/714 , triggered by spell 50240 "Evasive Maneuvers" script --- src/server/game/Entities/Unit/Unit.cpp | 6 ++++++ src/server/game/Spells/SpellScript.cpp | 4 ++-- src/server/game/Spells/SpellScript.h | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index daea7fac3f..6cd67ee430 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3587,6 +3587,12 @@ void Unit::RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode) ASSERT(aura->GetOwner() == this); + if (removeMode == AURA_REMOVE_NONE) + { + TC_LOG_ERROR("spells", "Unit::RemoveOwnedAura() called with unallowed removeMode AURA_REMOVE_NONE, spellId %u", aura->GetId()); + return; + } + uint32 spellId = aura->GetId(); AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId); diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index dce2422023..96977804f7 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -1001,9 +1001,9 @@ DynamicObject* AuraScript::GetDynobjOwner() const return m_aura->GetDynobjOwner(); } -void AuraScript::Remove(uint32 removeMode) +void AuraScript::Remove(AuraRemoveMode removeMode) { - m_aura->Remove((AuraRemoveMode)removeMode); + m_aura->Remove(removeMode); } Aura* AuraScript::GetAura() const diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index c7bbe0ed01..0916a43498 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -813,7 +813,7 @@ class AuraScript : public _SpellScript DynamicObject* GetDynobjOwner() const; // removes aura with remove mode (see AuraRemoveMode enum) - void Remove(uint32 removeMode = 0); + void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); // returns aura object of script Aura* GetAura() const; From 42f1a0babfaacf64df31a934288979f8edfec940 Mon Sep 17 00:00:00 2001 From: Aokromes Date: Thu, 8 Jan 2015 10:08:45 +0100 Subject: [PATCH 05/33] DB/Creature: Toc binding must start at Icehowl not at Gormok --- sql/updates/world/2015_01_08_00_world.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 sql/updates/world/2015_01_08_00_world.sql diff --git a/sql/updates/world/2015_01_08_00_world.sql b/sql/updates/world/2015_01_08_00_world.sql new file mode 100644 index 0000000000..7d5a19751e --- /dev/null +++ b/sql/updates/world/2015_01_08_00_world.sql @@ -0,0 +1,2 @@ +-- +UPDATE `creature_template` SET `flags_extra`=0 WHERE `entry` IN (34796,34799,35438,35439,35440,35514,35515,35516); From 9d56c9a1049fb15394831279bfb68e7acb9c28cd Mon Sep 17 00:00:00 2001 From: Aokromes Date: Fri, 9 Jan 2015 10:20:00 +0100 Subject: [PATCH 06/33] DB/Quest: Change default RewardHonorMultiplier to 0 --- sql/updates/world/2015_01_09_00_world.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 sql/updates/world/2015_01_09_00_world.sql diff --git a/sql/updates/world/2015_01_09_00_world.sql b/sql/updates/world/2015_01_09_00_world.sql new file mode 100644 index 0000000000..861584cab4 --- /dev/null +++ b/sql/updates/world/2015_01_09_00_world.sql @@ -0,0 +1,3 @@ +-- +ALTER TABLE `quest_template` CHANGE `RewardHonorMultiplier` `RewardHonorMultiplier` FLOAT NOT NULL DEFAULT '0'; +UPDATE `creature_template` SET `flags_extra`=0 WHERE `entry` IN (35144,35511,35512,35513); From 9c9e5abca3dd9bdc8f776ffacd72500367e56043 Mon Sep 17 00:00:00 2001 From: Nyeriah Date: Sat, 10 Jan 2015 02:35:28 -0200 Subject: [PATCH 07/33] Scripts/HellfireRamparts: Remove the spawning of the Reinforced Fel Iron chest from scripts Updates #13747 --- sql/updates/world/2015_01_09_01_world.sql | 5 +++++ .../HellfireRamparts/boss_vazruden_the_herald.cpp | 7 ------- .../HellfireRamparts/hellfire_ramparts.h | 2 +- .../instance_hellfire_ramparts.cpp | 14 ++++++-------- 4 files changed, 12 insertions(+), 16 deletions(-) create mode 100644 sql/updates/world/2015_01_09_01_world.sql diff --git a/sql/updates/world/2015_01_09_01_world.sql b/sql/updates/world/2015_01_09_01_world.sql new file mode 100644 index 0000000000..d07bd8b416 --- /dev/null +++ b/sql/updates/world/2015_01_09_01_world.sql @@ -0,0 +1,5 @@ +-- Replace the previously spawned chests with sniffed ones +DELETE FROM `gameobject` WHERE `id` IN (185168, 185169) AND `guid` IN (20499, 20496); +INSERT INTO `gameobject` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`, `VerifiedBuild`) VALUES +(20496, 185168, 543, 3, 1, -1429.81, 1772.916, 82.0765, 5.044002, 0, 0, 0, 1, 7200, 255, 1, 19243), -- 185168 (Area: 3562) +(20499, 185169, 543, 3, 1, -1429.81, 1772.916, 82.0765, 5.044002, 0, 0, 0, 1, 7200, 255, 1, 19243); -- 185169 (Area: 3562) diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index f3e655b45b..b23dbb2db2 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -434,13 +434,6 @@ class boss_vazruden_the_herald : public CreatureScript return; } } - else if (!lootSpawned) - { - me->SummonGameObject(DUNGEON_MODE(GO_FEL_IRON_CHEST_NORMAL, GO_FEL_IRON_CHECT_HEROIC), VazrudenMiddle[0], VazrudenMiddle[1], VazrudenMiddle[2], 0, 0, 0, 0, 0, 0); - me->SetLootRecipient(NULL); // don't think this is necessary.. - //me->Kill(me); - lootSpawned = true; - } check = 2000; } else diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h index 100a10fadc..f41b76a1a0 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h @@ -43,7 +43,7 @@ enum CreatureIds enum GameobjectIds { GO_FEL_IRON_CHEST_NORMAL = 185168, - GO_FEL_IRON_CHECT_HEROIC = 185169 + GO_FEL_IRON_CHEST_HEROIC = 185169 }; #endif diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp index 1e8f1b5e9a..4d45845c64 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp @@ -36,7 +36,6 @@ class instance_ramparts : public InstanceMapScript { instance_ramparts_InstanceMapScript(Map* map) : InstanceScript(map) { - spawned = false; SetHeaders(DataHeader); SetBossNumber(EncounterCount); } @@ -46,7 +45,7 @@ class instance_ramparts : public InstanceMapScript switch (go->GetEntry()) { case GO_FEL_IRON_CHEST_NORMAL: - case GO_FEL_IRON_CHECT_HEROIC: + case GO_FEL_IRON_CHEST_HEROIC: felIronChestGUID = go->GetGUID(); break; } @@ -61,11 +60,11 @@ class instance_ramparts : public InstanceMapScript { case DATA_VAZRUDEN: case DATA_NAZAN: - if (GetBossState(DATA_VAZRUDEN) == DONE && GetBossState(DATA_NAZAN) == DONE && !spawned) - { - DoRespawnGameObject(felIronChestGUID, HOUR*IN_MILLISECONDS); - spawned = true; - } + if (GetBossState(DATA_VAZRUDEN) == DONE && GetBossState(DATA_NAZAN) == DONE) + if (GameObject* chest = instance->GetGameObject(felIronChestGUID)) + chest->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + break; + default: break; } return true; @@ -73,7 +72,6 @@ class instance_ramparts : public InstanceMapScript protected: ObjectGuid felIronChestGUID; - bool spawned; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override From 1852d7d2f7b808efb1ec505ce1ca6867219f3588 Mon Sep 17 00:00:00 2001 From: Nyeriah Date: Sat, 10 Jan 2015 02:51:00 -0200 Subject: [PATCH 08/33] Scripts/BlackfathomDepths: Convert bosses to EventMaps/BossAI and clean up instance script --- .../BlackfathomDeeps/blackfathom_deeps.h | 3 +- .../BlackfathomDeeps/boss_aku_mai.cpp | 32 +++--- .../BlackfathomDeeps/boss_gelihast.cpp | 61 ++++------- .../Kalimdor/BlackfathomDeeps/boss_kelris.cpp | 90 +++++++-------- .../instance_blackfathom_deeps.cpp | 103 ++++++++---------- 5 files changed, 131 insertions(+), 158 deletions(-) diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h index 4d65ec6e29..cb1cd3829b 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h @@ -21,6 +21,8 @@ #define DataHeader "BFD" +uint32 const EncounterCount = 3; + enum Data64 { DATA_SHRINE1, @@ -37,7 +39,6 @@ enum Data { TYPE_GELIHAST, TYPE_KELRIS, - TYPE_SHRINE, TYPE_AKU_MAI, DATA_FIRE, DATA_EVENT diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp index cb5c40cadc..99790e6d70 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp @@ -28,7 +28,7 @@ enum Spells enum Events { EVENT_POISON_CLOUD = 1, - EVENT_FRENZIED_RAGE = 2 + EVENT_FRENZIED_RAGE, }; class boss_aku_mai : public CreatureScript @@ -56,13 +56,17 @@ public: void EnterCombat(Unit* /*who*/) override { - events.ScheduleEvent(EVENT_POISON_CLOUD, urand(5000, 9000)); _EnterCombat(); + events.ScheduleEvent(EVENT_POISON_CLOUD, urand(5000, 9000)); } - void JustDied(Unit* /*killer*/) override + void DamageTaken(Unit* /*atacker*/, uint32 &damage) override { - _JustDied(); + if (!IsEnraged && me->HealthBelowPctDamaged(30, damage)) + { + DoCast(me, SPELL_FRENZIED_RAGE); + IsEnraged = true; + } } void UpdateAI(uint32 diff) override @@ -72,25 +76,15 @@ public: events.Update(diff); - if (!IsEnraged && HealthBelowPct(30)) - events.ScheduleEvent(EVENT_FRENZIED_RAGE, 100); - while (uint32 eventId = events.ExecuteEvent()) { - switch (eventId) + if (eventId == EVENT_POISON_CLOUD) { - case EVENT_POISON_CLOUD: - DoCastVictim(SPELL_POISON_CLOUD); - events.ScheduleEvent(EVENT_POISON_CLOUD, urand(25000, 50000)); - break; - case EVENT_FRENZIED_RAGE: - DoCast(me, SPELL_FRENZIED_RAGE); - IsEnraged = true; - break; - default: - break; + DoCastVictim(SPELL_POISON_CLOUD); + events.ScheduleEvent(EVENT_POISON_CLOUD, urand(25000, 50000)); } } + DoMeleeAttackIfReady(); } @@ -100,7 +94,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new boss_aku_maiAI(creature); + return GetInstanceAI(creature); } }; diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp index a432a5714e..4e31bf8d64 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp @@ -21,7 +21,12 @@ enum Spells { - SPELL_NET = 6533 + SPELL_NET = 6533 +}; + +enum Events +{ + EVENT_THROW_NET = 1 }; class boss_gelihast : public CreatureScript @@ -29,42 +34,14 @@ class boss_gelihast : public CreatureScript public: boss_gelihast() : CreatureScript("boss_gelihast") { } - CreatureAI* GetAI(Creature* creature) const override + struct boss_gelihastAI : public BossAI { - return GetInstanceAI(creature); - } - - struct boss_gelihastAI : public ScriptedAI - { - boss_gelihastAI(Creature* creature) : ScriptedAI(creature) - { - Initialize(); - instance = creature->GetInstanceScript(); - } - - void Initialize() - { - netTimer = urand(2000, 4000); - } - - uint32 netTimer; - - InstanceScript* instance; - - void Reset() override - { - Initialize(); - instance->SetData(TYPE_GELIHAST, NOT_STARTED); - } + boss_gelihastAI(Creature* creature) : BossAI(creature, TYPE_GELIHAST) { } void EnterCombat(Unit* /*who*/) override { - instance->SetData(TYPE_GELIHAST, IN_PROGRESS); - } - - void JustDied(Unit* /*killer*/) override - { - instance->SetData(TYPE_GELIHAST, DONE); + _EnterCombat(); + events.ScheduleEvent(EVENT_THROW_NET, urand(2000, 4000)); } void UpdateAI(uint32 diff) override @@ -72,15 +49,25 @@ public: if (!UpdateVictim()) return; - if (netTimer < diff) + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) { - DoCastVictim(SPELL_NET); - netTimer = urand(4000, 7000); - } else netTimer -= diff; + if (eventId == EVENT_THROW_NET) + { + DoCastVictim(SPELL_NET); + events.ScheduleEvent(EVENT_THROW_NET, urand(4000, 7000)); + } + } DoMeleeAttackIfReady(); } }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetInstanceAI(creature); + } }; void AddSC_boss_gelihast() diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp index 202c50014f..4aed860b3b 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp @@ -21,12 +21,21 @@ enum Spells { - SPELL_MIND_BLAST = 15587, - SPELL_SLEEP = 8399, + SPELL_MIND_BLAST = 15587, + SPELL_SLEEP = 8399, +}; - SAY_AGGRO = 0, - SAY_SLEEP = 1, - SAY_DEATH = 2 +enum Texts +{ + SAY_AGGRO = 0, + SAY_SLEEP = 1, + SAY_DEATH = 2 +}; + +enum Events +{ + EVENT_MIND_BLAST = 1, + EVENT_SLEEP }; class boss_kelris : public CreatureScript @@ -34,40 +43,16 @@ class boss_kelris : public CreatureScript public: boss_kelris() : CreatureScript("boss_kelris") { } - CreatureAI* GetAI(Creature* creature) const override + struct boss_kelrisAI : public BossAI { - return GetInstanceAI(creature); - } - - struct boss_kelrisAI : public ScriptedAI - { - boss_kelrisAI(Creature* creature) : ScriptedAI(creature) - { - Initialize(); - instance = creature->GetInstanceScript(); - } - - void Initialize() - { - mindBlastTimer = urand(2000, 5000); - sleepTimer = urand(9000, 12000); - } - - uint32 mindBlastTimer; - uint32 sleepTimer; - - InstanceScript* instance; - - void Reset() override - { - Initialize(); - instance->SetData(TYPE_KELRIS, NOT_STARTED); - } + boss_kelrisAI(Creature* creature) : BossAI(creature, TYPE_KELRIS) { } void EnterCombat(Unit* /*who*/) override { + _EnterCombat(); Talk(SAY_AGGRO); - instance->SetData(TYPE_KELRIS, IN_PROGRESS); + events.ScheduleEvent(EVENT_MIND_BLAST, urand(2000, 5000)); + events.ScheduleEvent(EVENT_SLEEP, urand(9000, 12000)); } void JustDied(Unit* /*killer*/) override @@ -81,25 +66,40 @@ public: if (!UpdateVictim()) return; - if (mindBlastTimer < diff) - { - DoCastVictim(SPELL_MIND_BLAST); - mindBlastTimer = urand(7000, 9000); - } else mindBlastTimer -= diff; + events.Update(diff); - if (sleepTimer < diff) + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + switch (eventId) { - Talk(SAY_SLEEP); - DoCast(target, SPELL_SLEEP); + case EVENT_MIND_BLAST: + DoCastVictim(SPELL_MIND_BLAST); + events.ScheduleEvent(EVENT_MIND_BLAST, urand(7000, 9000)); + break; + case EVENT_SLEEP: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + Talk(SAY_SLEEP); + DoCast(target, SPELL_SLEEP); + } + events.ScheduleEvent(EVENT_SLEEP, urand(15000, 20000)); + break; + default: + break; } - sleepTimer = urand(15000, 20000); - } else sleepTimer -= diff; + } DoMeleeAttackIfReady(); } }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetInstanceAI(creature); + } }; void AddSC_boss_kelris() diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp index f6fdd260c0..77bb342107 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp @@ -27,14 +27,6 @@ EndScriptData */ #include "InstanceScript.h" #include "blackfathom_deeps.h" -#define MAX_ENCOUNTER 4 - -/* Encounter 0 = Gelihast - Encounter 1 = Twilight Lord Kelris - Encounter 2 = Shrine event - Encounter 3 = Aku'Mai - */ - const Position LorgusPosition[4] = { { -458.500610f, -38.343079f, -33.474445f, 0.0f }, @@ -67,25 +59,12 @@ public: instance_blackfathom_deeps_InstanceMapScript(Map* map) : InstanceScript(map) { SetHeaders(DataHeader); - memset(&encounter, 0, sizeof(encounter)); + SetBossNumber(EncounterCount); countFires = 0; deathTimes = 0; } - ObjectGuid twilightLordKelrisGUID; - ObjectGuid shrine1GUID; - ObjectGuid shrine2GUID; - ObjectGuid shrine3GUID; - ObjectGuid shrine4GUID; - ObjectGuid shrineOfGelihastGUID; - ObjectGuid altarOfTheDeepsGUID; - ObjectGuid mainDoorGUID; - - uint8 encounter[MAX_ENCOUNTER]; - uint8 countFires; - uint8 deathTimes; - void OnCreatureCreate(Creature* creature) override { switch (creature->GetEntry()) @@ -117,16 +96,16 @@ public: break; case GO_SHRINE_OF_GELIHAST: shrineOfGelihastGUID = go->GetGUID(); - if (encounter[0] != DONE) + if (GetBossState(TYPE_GELIHAST) != DONE) go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); break; case GO_ALTAR_OF_THE_DEEPS: altarOfTheDeepsGUID = go->GetGUID(); - if (encounter[3] != DONE) + if (GetBossState(TYPE_AKU_MAI) != DONE) go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); break; case GO_AKU_MAI_DOOR: - if (encounter[2] == DONE) + if (GetBossState(TYPE_AKU_MAI) == DONE) HandleGameObject(ObjectGuid::Empty, true, go); mainDoorGUID = go->GetGUID(); break; @@ -137,21 +116,6 @@ public: { switch (type) { - case TYPE_GELIHAST: - encounter[0] = data; - if (data == DONE) - if (GameObject* go = instance->GetGameObject(shrineOfGelihastGUID)) - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - break; - case TYPE_AKU_MAI: - encounter[3] = data; - if (data == DONE) - if (GameObject* go = instance->GetGameObject(altarOfTheDeepsGUID)) - { - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - go->SummonCreature(NPC_MORRIDUNE, SpawnsLocation[4], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - } - break; case DATA_FIRE: countFires = data; switch (countFires) @@ -159,10 +123,8 @@ public: case 1: if (GameObject* go = instance->GetGameObject(shrine1GUID)) { - go->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - go->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - go->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - go->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + for (uint8 i = 0; i < 4; ++i) + go->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); } break; case 2: @@ -187,10 +149,8 @@ public: case 4: if (GameObject* go = instance->GetGameObject(shrine1GUID)) { - go->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - go->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - go->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - go->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + for (uint8 i = 0; i < 4; ++i) + go->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); } break; } @@ -203,18 +163,37 @@ public: } } + bool SetBossState(uint32 type, EncounterState state) override + { + if (!InstanceScript::SetBossState(type, state)) + return false; + + switch (type) + { + case TYPE_GELIHAST: + if (state == DONE) + if (GameObject* go = instance->GetGameObject(shrineOfGelihastGUID)) + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + break; + case TYPE_AKU_MAI: + if (state == DONE) + if (GameObject* go = instance->GetGameObject(altarOfTheDeepsGUID)) + { + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + go->SummonCreature(NPC_MORRIDUNE, SpawnsLocation[4], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + } + break; + default: + break; + } + + return true; + } + uint32 GetData(uint32 type) const override { switch (type) { - case TYPE_GELIHAST: - return encounter[0]; - case TYPE_KELRIS: - return encounter[1]; - case TYPE_SHRINE: - return encounter[2]; - case TYPE_AKU_MAI: - return encounter[3]; case DATA_FIRE: return countFires; case DATA_EVENT: @@ -246,6 +225,18 @@ public: return ObjectGuid::Empty; } + + private: + ObjectGuid twilightLordKelrisGUID; + ObjectGuid shrine1GUID; + ObjectGuid shrine2GUID; + ObjectGuid shrine3GUID; + ObjectGuid shrine4GUID; + ObjectGuid shrineOfGelihastGUID; + ObjectGuid altarOfTheDeepsGUID; + ObjectGuid mainDoorGUID; + uint8 countFires; + uint8 deathTimes; }; }; From 0baa4deb3f93dd97bb694a05f04dbe6474dadba7 Mon Sep 17 00:00:00 2001 From: Nyeriah Date: Sat, 10 Jan 2015 03:02:26 -0200 Subject: [PATCH 09/33] Scripts/HellfireRamparts: Clean up a forgotten no longer used variable --- .../HellfireRamparts/boss_vazruden_the_herald.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index b23dbb2db2..3951b0eadf 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -297,7 +297,6 @@ class boss_vazruden_the_herald : public CreatureScript Initialize(); summoned = false; sentryDown = false; - lootSpawned = false; } void Initialize() @@ -450,7 +449,6 @@ class boss_vazruden_the_herald : public CreatureScript ObjectGuid NazanGUID; ObjectGuid VazrudenGUID; bool summoned; - bool lootSpawned; }; CreatureAI* GetAI(Creature* creature) const override From db849e7fccd1545435dacbc94f5e42142c8b6ced Mon Sep 17 00:00:00 2001 From: Rushor Date: Sat, 10 Jan 2015 05:19:59 +0000 Subject: [PATCH 10/33] Scripts/Stratholme: Move Maleki the Pallid to Eventmaps Closes #13871 --- .../Stratholme/boss_maleki_the_pallid.cpp | 73 ++++++++++--------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp index 96651e5bff..52078ceef8 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp @@ -33,7 +33,14 @@ enum Spells SPELL_DRAINLIFE = 20743, SPELL_DRAIN_MANA = 17243, SPELL_ICETOMB = 16869 +}; +enum MalekiEvents +{ + EVENT_FROSTBOLT = 1, + EVENT_DRAINLIFE = 2, + EVENT_DRAIN_MANA = 3, + EVENT_ICETOMB = 4 }; class boss_maleki_the_pallid : public CreatureScript @@ -50,30 +57,19 @@ public: { boss_maleki_the_pallidAI(Creature* creature) : ScriptedAI(creature) { - Initialize(); instance = me->GetInstanceScript(); } - void Initialize() - { - Frostbolt_Timer = 1000; - IceTomb_Timer = 16000; - DrainLife_Timer = 31000; - } - - InstanceScript* instance; - - uint32 Frostbolt_Timer; - uint32 IceTomb_Timer; - uint32 DrainLife_Timer; - void Reset() override { - Initialize(); + _events.Reset(); } void EnterCombat(Unit* /*who*/) override { + _events.ScheduleEvent(EVENT_FROSTBOLT, 1 * IN_MILLISECONDS); + _events.ScheduleEvent(EVENT_ICETOMB, 16 * IN_MILLISECONDS); + _events.ScheduleEvent(EVENT_DRAINLIFE, 31 * IN_MILLISECONDS); } void JustDied(Unit* /*killer*/) override @@ -87,32 +83,37 @@ public: if (!UpdateVictim()) return; - //Frostbolt - if (Frostbolt_Timer <= diff) - { - if (rand32() % 100 < 90) - DoCastVictim(SPELL_FROSTBOLT); - Frostbolt_Timer = 3500; - } else Frostbolt_Timer -= diff; + _events.Update(diff); - //IceTomb - if (IceTomb_Timer <= diff) + while (uint32 eventId = _events.ExecuteEvent()) { - if (rand32() % 100 < 65) - DoCastVictim(SPELL_ICETOMB); - IceTomb_Timer = 28000; - } else IceTomb_Timer -= diff; - - //DrainLife - if (DrainLife_Timer <= diff) - { - if (rand32() % 100 < 55) - DoCastVictim(SPELL_DRAINLIFE); - DrainLife_Timer = 31000; - } else DrainLife_Timer -= diff; + switch (eventId) + { + case EVENT_FROSTBOLT: + if (rand32() % 90) + DoCastVictim(SPELL_FROSTBOLT); + _events.ScheduleEvent(EVENT_FROSTBOLT, 3.5 * IN_MILLISECONDS); + break; + case EVENT_ICETOMB: + if (rand32() % 65) + DoCastVictim(SPELL_ICETOMB); + _events.ScheduleEvent(EVENT_ICETOMB, 28 * IN_MILLISECONDS); + break; + case EVENT_DRAINLIFE: + if (rand32() % 55) + DoCastVictim(SPELL_DRAINLIFE); + _events.ScheduleEvent(EVENT_DRAINLIFE, 31 * IN_MILLISECONDS); + break; + default: + break; + } + } DoMeleeAttackIfReady(); } + private: + EventMap _events; + InstanceScript* instance; }; }; From f94cfc65771f53cd2b693779ecd00705cd66593a Mon Sep 17 00:00:00 2001 From: MitchesD Date: Sat, 10 Jan 2015 22:58:03 +0100 Subject: [PATCH 11/33] Scripts/Misc: some random changes after recent commits and cleanup --- .../Stratholme/boss_maleki_the_pallid.cpp | 13 ++++++----- .../Stratholme/boss_postmaster_malown.cpp | 6 +++-- .../BlackfathomDeeps/blackfathom_deeps.h | 6 ++--- .../BlackfathomDeeps/boss_aku_mai.cpp | 22 +++++++------------ .../BlackfathomDeeps/boss_gelihast.cpp | 2 +- .../Kalimdor/BlackfathomDeeps/boss_kelris.cpp | 4 ++-- .../instance_blackfathom_deeps.cpp | 10 ++++----- 7 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp index 52078ceef8..b094eb45dc 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp @@ -48,11 +48,6 @@ class boss_maleki_the_pallid : public CreatureScript public: boss_maleki_the_pallid() : CreatureScript("boss_maleki_the_pallid") { } - CreatureAI* GetAI(Creature* creature) const override - { - return GetInstanceAI(creature); - } - struct boss_maleki_the_pallidAI : public ScriptedAI { boss_maleki_the_pallidAI(Creature* creature) : ScriptedAI(creature) @@ -85,6 +80,9 @@ public: _events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + while (uint32 eventId = _events.ExecuteEvent()) { switch (eventId) @@ -111,11 +109,16 @@ public: DoMeleeAttackIfReady(); } + private: EventMap _events; InstanceScript* instance; }; + CreatureAI* GetAI(Creature* creature) const override + { + return GetInstanceAI(creature); + } }; void AddSC_boss_maleki_the_pallid() diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp index 6d9ccc5e88..0b3fa2e7ca 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp @@ -55,7 +55,8 @@ enum Events class boss_postmaster_malown : public CreatureScript { - public: boss_postmaster_malown() : CreatureScript("boss_postmaster_malown") { } + public: + boss_postmaster_malown() : CreatureScript("boss_postmaster_malown") { } struct boss_postmaster_malownAI : public BossAI { @@ -120,13 +121,14 @@ class boss_postmaster_malown : public CreatureScript break; } } + DoMeleeAttackIfReady(); } }; CreatureAI* GetAI(Creature* creature) const override { - return new boss_postmaster_malownAI(creature); + return GetInstanceAI(creature); } }; diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h index cb1cd3829b..be2f526892 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h @@ -37,9 +37,9 @@ enum Data64 enum Data { - TYPE_GELIHAST, - TYPE_KELRIS, - TYPE_AKU_MAI, + DATA_GELIHAST, + DATA_KELRIS, + DATA_AKU_MAI, DATA_FIRE, DATA_EVENT }; diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp index 99790e6d70..46008244aa 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp @@ -28,7 +28,7 @@ enum Spells enum Events { EVENT_POISON_CLOUD = 1, - EVENT_FRENZIED_RAGE, + EVENT_FRENZIED_RAGE }; class boss_aku_mai : public CreatureScript @@ -38,7 +38,7 @@ public: struct boss_aku_maiAI : public BossAI { - boss_aku_maiAI(Creature* creature) : BossAI(creature, TYPE_AKU_MAI) + boss_aku_maiAI(Creature* creature) : BossAI(creature, DATA_AKU_MAI) { Initialize(); } @@ -69,23 +69,17 @@ public: } } - void UpdateAI(uint32 diff) override + void ExecuteEvent(uint32 eventId) override { - if (!UpdateVictim()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + switch (eventId) { - if (eventId == EVENT_POISON_CLOUD) - { + case EVENT_POISON_CLOUD: DoCastVictim(SPELL_POISON_CLOUD); events.ScheduleEvent(EVENT_POISON_CLOUD, urand(25000, 50000)); - } + break; + default: + break; } - - DoMeleeAttackIfReady(); } private: diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp index 4e31bf8d64..a68558b9c2 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp @@ -36,7 +36,7 @@ public: struct boss_gelihastAI : public BossAI { - boss_gelihastAI(Creature* creature) : BossAI(creature, TYPE_GELIHAST) { } + boss_gelihastAI(Creature* creature) : BossAI(creature, DATA_GELIHAST) { } void EnterCombat(Unit* /*who*/) override { diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp index 4aed860b3b..4bff75d8ef 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp @@ -45,7 +45,7 @@ public: struct boss_kelrisAI : public BossAI { - boss_kelrisAI(Creature* creature) : BossAI(creature, TYPE_KELRIS) { } + boss_kelrisAI(Creature* creature) : BossAI(creature, DATA_KELRIS) { } void EnterCombat(Unit* /*who*/) override { @@ -58,7 +58,7 @@ public: void JustDied(Unit* /*killer*/) override { Talk(SAY_DEATH); - instance->SetData(TYPE_KELRIS, DONE); + _JustDied(); } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp index 77bb342107..458539f1da 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp @@ -96,16 +96,16 @@ public: break; case GO_SHRINE_OF_GELIHAST: shrineOfGelihastGUID = go->GetGUID(); - if (GetBossState(TYPE_GELIHAST) != DONE) + if (GetBossState(DATA_GELIHAST) != DONE) go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); break; case GO_ALTAR_OF_THE_DEEPS: altarOfTheDeepsGUID = go->GetGUID(); - if (GetBossState(TYPE_AKU_MAI) != DONE) + if (GetBossState(DATA_AKU_MAI) != DONE) go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); break; case GO_AKU_MAI_DOOR: - if (GetBossState(TYPE_AKU_MAI) == DONE) + if (GetBossState(DATA_AKU_MAI) == DONE) HandleGameObject(ObjectGuid::Empty, true, go); mainDoorGUID = go->GetGUID(); break; @@ -170,12 +170,12 @@ public: switch (type) { - case TYPE_GELIHAST: + case DATA_GELIHAST: if (state == DONE) if (GameObject* go = instance->GetGameObject(shrineOfGelihastGUID)) go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); break; - case TYPE_AKU_MAI: + case DATA_AKU_MAI: if (state == DONE) if (GameObject* go = instance->GetGameObject(altarOfTheDeepsGUID)) { From 81f1e03a5a895fadac59b1821a6d36b76771b9f7 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Sun, 11 Jan 2015 12:28:18 +0100 Subject: [PATCH 12/33] Core/Spells: fixed Shatter crit chance modifier Closes #13885 --- src/server/game/Entities/Unit/Unit.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 6cd67ee430..fdd9136870 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9592,7 +9592,7 @@ int32 Unit::DealHeal(Unit* victim, uint32 addhealth) bool Unit::IsMagnet() const { - // Grounding Totem + // Grounding Totem if (GetUInt32Value(UNIT_CREATED_BY_SPELL) == 8177) /// @todo: find a more generic solution return true; @@ -10506,7 +10506,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto switch ((*i)->GetMiscValue()) { - case 911: // Shatter (Rank 1) + case 849: // Shatter (Rank 1) if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) crit_chance += 17; break; @@ -10514,7 +10514,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) crit_chance += 34; break; - case 849: // Shatter (Rank 3) + case 911: // Shatter (Rank 3) if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) crit_chance += 50; break; From fb1b7f66a5d959e4b080a8b25cd697c9764a098f Mon Sep 17 00:00:00 2001 From: Dr-J Date: Sun, 11 Jan 2015 12:13:06 +0000 Subject: [PATCH 13/33] DB/Misc: Lights Vengence Closes #13856 Script working, there are some issues with spell targeting for aod spells used by Lich King and Vegard to summon ghouls but this is fixed by applying the dbc hack by Rushor from original issue to limit spell targets. --- sql/updates/world/2015_01_11_00_world.sql | 229 ++++++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 sql/updates/world/2015_01_11_00_world.sql diff --git a/sql/updates/world/2015_01_11_00_world.sql b/sql/updates/world/2015_01_11_00_world.sql new file mode 100644 index 0000000000..8fa014fa74 --- /dev/null +++ b/sql/updates/world/2015_01_11_00_world.sql @@ -0,0 +1,229 @@ +-- Lights Vengence + +SET @QUEST := 24546;-- The Sacred and the Corrupt +SET @TRIGG := 5650; +SET @LIGHTSVENGENCE:= 49869; +SET @BUNNY := 37832;-- Lich King Stun Bunny +SET @BUNNY2 := 37878;-- AoD Impact Bunny + +SET @LICHKING := 37857;-- The Lich King + +SET @CGUID := 76000; + +UPDATE `creature_template` SET `flags_extra`=130 WHERE `entry`=37826; +UPDATE `creature_template` SET `unit_flags`=768, `unit_flags2`=2099200, `dynamicflags`=1613035584 WHERE `entry`=37857; +UPDATE `creature_template` SET `unit_flags`=33554688, `unit_flags2`=2099200, `dynamicflags`=1613037824 WHERE `entry`=37894; +UPDATE `creature_template` SET `unit_flags`=33554688, `unit_flags2`=2099200, `dynamicflags`=1613036800 WHERE `entry`=37878; + + +DELETE FROM `areatrigger_scripts` WHERE `entry` = @TRIGG; +INSERT INTO `areatrigger_scripts`(`entry`, `ScriptName`) VALUES +(@TRIGG,'SmartTrigger'); + +DELETE FROM `smart_scripts` WHERE `entryorguid` =@TRIGG AND `source_type`=2; +INSERT INTO `smart_scripts`(`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@TRIGG,2,0,1,46,0,100,0,@TRIGG,0,0,0,64,1,0,0,0,0,0,7,0,0,0,0,0,0,0,"On Trigger - Store Target List"), +(@TRIGG,2,1,2,61,0,100,0,@TRIGG,0,0,0,100,1,0,0,0,0,0,10,@CGUID,@BUNNY,0,0,0,0,0,"On Trigger - Send Target List to Lich King Stun Bunny"), +(@TRIGG,2,2,0,61,0,100,0,0,0,0,0,45,1,1,0,0,0,0,10,@CGUID,@BUNNY,0,0,0,0,0,"On Trigger - Set Data on Lich King Stun Bunny"); + +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE`entry`IN(@BUNNY,@LICHKING,37827,37832,@BUNNY2,37881,37894,37893,38001,37976,37826,37952); + +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(@BUNNY,@LICHKING,37827,37832,@BUNNY2,37881,37894,37893,38001,37976,37826,37952) AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(@LICHKING*100,37893*100,37952*100,3795201) AND `source_type`=9; + +INSERT INTO `smart_scripts`(`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@BUNNY,0,0,1,38,0,100,0,1,1,300000,300000,45,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Lich King Stun Bunny - On Data Set - Set Data"), +(@BUNNY,0,1,2,61,0,100,0,0,0,0,0,11,70583,0,0,0,0,0,12,1,0,0,0, 0, 0, 0,"Lich King Stun Bunny - On Data Set - Cast Lich King Stun"), +(@BUNNY,0,2,0,61,0,100,0,0,0,0,0,12,@LICHKING,1,300000,0,0,0,8,0,0,0,4835.083, -586.7692, 162.0051, 2.804995,"Lich King Stun Bunny - On Data Set - Summon The Lich Kin"), +(@BUNNY,0,3,4,38,0,100,0,2,2,0,0,11,70571,0,0,0,0,0,1,0,0,0,0,0,0,0,"Lich King Stunn Bunny - On Data Set - Cast Holy Zone Visual"), +(@BUNNY,0,4,0,61,0,100,0,0,0,0,0,11,70603,0,0,0,0,0,1,0,0,0,0,0,0,0,"Lich King Stunn Bunny - On Data Set - Cast Summon Light's Vengeance"), +(@BUNNY,0,5,0,38,0,100,0,3,3,0,0,28,70571,0,0,0,0,0,1,0,0,0,0,0,0,0,"Lich King Stunn Bunny - On Data Set - Remove Aura Holy Zone Visual"), +(@BUNNY2,0,0,0,8,0,100,0,70614,0,10000,15000,11,70617,0,0,0,0,0,1,0,0,0,0,0,0,0,"AOD Impact Bunny - On Spell Hit(AoD Special)- Cast Summon Ghoul"), +(@BUNNY2,0,1,0,8,0,100,0,70743,0,10000,15000,11,70617,0,0,0,0,0,1,0,0,0,0,0,0,0,"AOD Impact Bunny - On Spell Hit(AoD Special - Vegard)- Cast Summon Ghoul"), +(@LICHKING,0,0,0,54,0,100,0,0,0,0,0,53,0,@LICHKING,0,0,0,0,1,0,0,0,0,0,0,0,"The Lich King - On Just Summoned - Start WP"), +(@LICHKING,0,1,0,40,0,100,0,11,@LICHKING,0,0,80,@LICHKING*100,2,0,0,0,0,1,0,0,0,0,0,0,0,"The Lich King - On Reached WP11 - Run Script"), +(37826,0,0,1,11,0,100,0,0,0,0,0,12,37827,8,0,0,0,0,8,0,0,0,4812.009, -586.2327, 162.57,0,"Light's Vengeance - On Spawn - Spawn Light's Vengeance Vehicle Bunny"), +(37826,0,1,2,61,0,100,0,0,0,0,0,12,37952,8,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance - On Spawn - Spawn Light's Vengeance Vehicle Bunny 2"), +(37952,0,0,0,38,0,100,1,1,1,0,0,80,3795200,2,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance Vehicle Bunny 2 - On Data Set - Run Script"), +(37952,0,1,2,40,0,100,0,8,37952,0,0,80,3795201,2,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance Vehicle Bunny 2 - On Reached WP8 - Run Script 2"), +(37826,0,2,0,61,0,100,0,0,0,0,0,11,46598,0,0,0,0,0,19,37952,0,0,0,0,0,0,"Light's Vengeance - On Spawn - Cast Ride Vehicle Hardcoded"), +(37827,0,0,1,38,0,100,0,1,1,0,0,11,50630,2,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance Vehicle Bunny - On Data Set - Cast Eject All Passengers"), +(37827,0,1,2,61,0,100,0,0,0,0,0,11,70595,0,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance Vehicle Bunny - On Data Set - Cast Light's Vengeance Throw"), +(37827,0,2,0,61,0,100,0,0,0,0,0,70,300,0,0,0,0,0,20,201937,0,0,0,0,0,0,"Light's Vengeance Vehicle Bunny - On Data Set - Despawn Light's Vengence"), +(37881,0,0,1,54,0,100,0,0,0,0,0,11,7398,0,0,0,0,0,1,0,0,0,0,0,0,0,"Wretched Ghoul - On Just Summoned - Cast Rebirth"), +(37881,0,1,0,61,0,100,0,0,0,0,0,11,70782,0,0,0,0,0,1,0,0,0,0,0,0,0,"Wretched Ghoul - On Just Summoned - Cast Ghoul's Touch"), +(37881,0,2,0,8,0,100,0,70790,0,0,0,37,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Wretched Ghoul - On Spellhit(Zap Ghouls) - Die"), +(37894,0,0,0,8,0,100,0,70643,0,0,0,11,70644,0,0,0,0,0,1,0,0,0,0,0,0,0,"Vegard Bunny - On Spellhit(Zap Vegard Bunny) - Cast Summon Vegard"), +(37893,0,0,0,54,0,100,0,0,0,0,0,80,3789300,2,0,0,0,0,1,0,0,0,0,0,0,0,"Vegard the Unforgiven - On Just Summoned - Run Script"), +(37893,0,1,2,8,0,100,0,70792,0,0,0,37,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Vegard the Unforgiven - On Spell Hit(Kill Vegard) - Die"), +(37893,0,2,0,61,0,100,0,0,0,0,0,41,5000,0,0,0,0,0,1,0,0,0,0,0,0,0,"Vegard the Unforgiven - On Spell Hit(Kill Vegard) - Despawn"), +(38001,0,0,0,38,0,100,0,4,4,0,0,11,70862,2,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance Bunny 2 - On Data Set - Cast Summon Vegard Skeleton"), +(38001,0,1,2,38,0,100,0,1,1,0,0,11,70967,2,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance Bunny 2 - On Data Set- Cast Summon Light's Vengeance III"), +(38001,0,2,0,61,0,100,0,0,0,0,0,11,70970,0,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance Bunny 2 - On Data Set- Cast Hammer Shield"), +(38001,0,3,0,38,0,100,0,2,2,0,0,28,70970,0,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance Bunny 2 - On Data Set- Remove Aura Hammer Shield"), +(38001,0,4,0,38,0,100,0,3,3,0,0,11,70894,2,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance Bunny 2 - On Data Set- Cast Summon Light's Vengeance II"), +(37976,0,0,1,54,0,100,0,0,0,0,0,11,7398,0,0,0,0,0,1,0,0,0,0,0,0,0,"Vegard the Unforgiven - On Just Summoned - Cast Rebirth"), +(37976,0,1,0,61,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Vegard the Unforgiven - On Just Summoned - Say Line 0"), +(37976,0,2,3,6,0,100,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Vegard the Unforgiven - On Death - Say Line 1"), +(37976,0,3,4,61,0,100,0,0,0,0,0,45,2,2,0,0,0,0,19,38001,0,0,0,0,0,0,"Vegard the Unforgiven - On Death - Say Line Set Data 2 2 on Light's Vengeance Bunny 2"), +(37976,0,4,0,61,0,100,0,0,0,0,0,45,1,1,0,0,0,0,20,201937,0,0,0,0,0,0,"Vegard the Unforgiven - On Death - Say Line Set Data 1 1 on Light's Vengeance"), +(37976,0,5,0,9,0,100,0,0,10,20000,35000,11,70866,0,0,0,0,0,7,0,0,0,0,0,0,0,"Vegard the Unforgiven - On Range - Cast Shadow Blast"), +(37976,0,6,0,2,0,100,0,0,30,15000,25000,11,70886,0,0,0,0,0,2,0,0,0,0,0,0,0,"Vegard the Unforgiven - On Less than 30% HP - Cast Vegard's Thirst"), +(37976,0,7,0,0,0,100,0,3000,7000,25000,35000,11,71003,0,0,0,0,0,2,0,0,0,0,0,0,0,"Vegard the Unforgiven - IC - Cast Vegard's Vegard's Touch"), +(37976,0,8,9,7,0,100,0,0,0,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,"Vegard the Unforgiven - On Evade - Say Line 2"), +(37976,0,9,0,61,0,100,0,0,0,0,0,41,5000,0,0,0,0,0,1,0,0,0,0,0,0,0,"Vegard the Unforgiven - On Evade - Despawn"), +(@LICHKING*100,9,0,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"The Lich King - Script - Say Line 0"), -- 16:59:11.266 +(@LICHKING*100,9,1,0,0,0,100,0,7000,7000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"The Lich King - Script - Say Line 1"), -- 16:59:18.641 +(@LICHKING*100,9,2,0,0,0,100,0,4000,4000,0,0,11,70590,0,0,0,0,0,1,0,0,0,0,0,0,0,"The Lich King - Script - Say Line 1"), -- 16:59:22.156 +(@LICHKING*100,9,3,0,0,0,100,0,0,0,0,0,45,1,1,0,0,0,0,19,37827,0,0,0,0,0,0,"The Lich King - Script - Set Data on Light's Vengeance Vehicle Bunny"), -- 16:59:22.156 +(@LICHKING*100,9,4,0,0,0,100,0,3000,3000,0,0,45,2,2,0,0,0,0,19,@BUNNY,0,0,0,0,0,0,"The Lich King - Script - Set Data on Light's Vengeance Vehicle Bunny"), -- 16:59:25.375 +(@LICHKING*100,9,5,0,0,0,100,0,3000,3000,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,"The Lich King - Script - Say Line 2"), -- 16:59:28.344 +(@LICHKING*100,9,6,0,0,0,100,0,8000,8000,0,0,11,70612,0,0,0,0,0,1,0,0,0,0,0,0,0,"The Lich King - Script - Cast Summon Ghouls"), -- 16:59:36.687 +(@LICHKING*100,9,7,0,0,0,100,0,4000,4000,0,0,1,3,0,0,0,0,0,1,0,0,0,0,0,0,0,"The Lich King - Script - Say Line 3"), -- 16:59:40.484 +(@LICHKING*100,9,8,0,0,0,100,0,7000,7000,0,0,11,70643,0,0,0,0,0,19,37894,0,0,0,0,0,0,"The Lich King - Script - Cast Zap Vegard Bunny"), -- 16:59:47.672 +(@LICHKING*100,9,9,0,0,0,100,0,7000,7000,0,0,5,397,0,0,0,0,0,21,100,0,0,0,0,0,0,"The Lich King - Script - Play Emote OneShotPointNoSheathe(397)"), -- 16:59:54.906 +(@LICHKING*100,9,10,0,0,0,100,0,1000,1000,0,0,1,4,0,0,0,0,0,1,0,0,0,0,0,0,0,"The Lich King - Script - Say Line 4"), -- 16:59:55.031 +(@LICHKING*100,9,11,0,0,0,100,0,2000,2000,0,0,11,70653,0,0,0,0,0,21,50,0,0,0,0,0,0,"The Lich King - Script - Cast Lich King Zap Player"), -- 17:00:00.812 +(@LICHKING*100,9,12,0,0,0,100,0,3000,3000,0,0,11,70673,0,0,0,0,0,1,0,0,0,0,0,0,0,"The Lich King - Script - Cast Lich King Despawn"), -- 17:00:00.812 +(@LICHKING*100,9,13,0,0,0,100,0,1000,1000,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"The Lich King - Script - Despawn"), -- 17:00:00.812 +(37893*100,9,0,0,0,0,100,0,0,0,0,0,18,256,0,0,0,0,0,1,0,0,0,0,0,0,0,"Vegard the Unforgiven - Script - Set Unit Flags"), +(37893*100,9,1,0,0,0,100,0,0,0,0,0,11,70692,0,0,0,0,0,1,0,0,0,0,0,0,0,"Vegard the Unforgiven - Script - Cast Shield of the Lich King"), +(37893*100,9,2,0,0,0,100,0,3000,3000,0,0,11,70737,0,0,0,0,0,1,0,0,0,0,0,0,0,"Vegard the Unforgiven - Script - Cast Vegard Summon Ghouls"), +(37893*100,9,3,0,0,0,100,0,13000,13000,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Vegard the Unforgiven - Script - Say Line 0"), -- 17:00:15.609 +(37893*100,9,4,0,0,0,100,0,8000,8000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Vegard the Unforgiven - Script - Say Line 1"), -- 17:00:15.609 +(37952*100,9,0,0,0,0,100,0,0,0,0,0,11,70785,2,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance Vehicle Bunny 2 - Script - Cast Holy Bomb Visual"), +(37952*100,9,1,0,0,0,100,0,0,0,0,0,11,70789,2,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance Vehicle Bunny 2 - Script - Cast Zap Ghouls Aura"), +(37952*100,9,2,0,0,0,100,0,0,0,0,0,53,0,37952,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance Vehicle Bunny 2 - Script - Start WP"), +(3795201,9,0,0,0,0,100,0,0,0,0,0,11,70792,0,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance Vehicle Bunny 2 - Script 2 - Cast Kill Vegard"), +(3795201,9,1,0,0,0,100,0,0,0,0,0,11,70786,0,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance Vehicle Bunny 2 - Script 2 - Cast Holy Bomb Explosion"), +(3795201,9,2,0,0,0,100,0,0,0,0,0,12,38001,1,300000,0,0,0,8,0,0,0,4812.009, -586.2327, 162.57, 2.75762,'Lights Vengeance Vehicle Bunny 2 - Script 2 - Summon Lights Vengeance Bunny 2'), +(3795201,9,3,0,0,0,100,0,0,0,0,0,45,3,3,0,0,0,0,19,38001,0,0,0,0,0,0,"Light's Vengeance Vehicle Bunny 2 - Script 2 - Set Data 3 3 on Light's Vengeance Bunny 2"), +(3795201,9,4,0,0,0,100,0,0,0,0,0,41,120000,0,0,0,0,0,19,37826,0,0,0,0,0,0,"Light's Vengeance Vehicle Bunny 2 - Script 2 - Despawn Light's Vengeance"), +(3795201,9,5,0,0,0,100,0,0,0,0,0,41,120000,0,0,0,0,0,19,37827,0,0,0,0,0,0,"Light's Vengeance Vehicle Bunny 2 - Script 2 - Despawn Light's Vengeance Vehicle Bunny"), +(3795201,9,6,0,0,0,100,0,0,0,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance Vehicle Bunny 2 - Script 2 - Despawn"); + + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND`SourceEntry`=@TRIGG; + +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(22,1,@TRIGG,2,0,9,0,@QUEST,0,0,0,0,'','Trigger only activates if player is on and has not completed The Sacred and the Corrupt'), +(22,1,@TRIGG,2,0,2,0,@LIGHTSVENGENCE,1,0,1,0,'','Trigger does not activate if player already has lights vengence'); + +DELETE FROM `creature` WHERE `id`IN(@BUNNY,@BUNNY2,37826,37894); + +INSERT INTO `creature`(`guid`, `id`, `map`, `spawnMask`, `phaseMask`,`position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `MovementType`) VALUES +(@CGUID+0, @BUNNY, 571, 1, 1, 4798.7, -639.529, 160.5693, 4.34587, 120, 0, 0), +(@CGUID+1, @BUNNY2, 571, 1, 1, 4848.793, -601.8837, 157.445, 4.258604, 120, 0, 0), +(@CGUID+2, @BUNNY2, 571, 1, 1, 4845.159, -576.0278, 159.9401, 5.532694, 120, 0, 0), +(@CGUID+3, @BUNNY2, 571, 1, 1, 4826.658, -555.1059, 161.3158, 4.625123, 120, 0, 0), +(@CGUID+4, @BUNNY2, 571, 1, 1, 4829.419, -629.3629, 157.6456, 3.612832, 120, 0, 0), +(@CGUID+5, @BUNNY2, 571, 1, 1, 4779.228, -587.1545, 162.1223, 4.537856, 120, 0, 0), +(@CGUID+6, @BUNNY2, 571, 1, 1, 4782.333, -572.7118, 161.8683, 5.585053, 120, 0, 0), +(@CGUID+7, @BUNNY2, 571, 1, 1, 4796.73, -622.5868, 159.9098, 2.356194, 120, 0, 0), +(@CGUID+8, @BUNNY2, 571, 1, 1, 4815.688, -625.3021, 158.6156, 4.066617, 120, 0, 0), +(@CGUID+9, @BUNNY2, 571, 1, 1, 4792.949, -603.3854, 160.3281, 2.740167, 120, 0, 0), +(@CGUID+10, @BUNNY2, 571, 1, 1, 4795.549, -631.2952, 160.2526, 1.361357, 120, 0, 0), +(@CGUID+11, @BUNNY2, 571, 1, 1, 4804.116, -640.8143, 160.1202, 2.373648, 120, 0, 0), +(@CGUID+12, @BUNNY2, 571, 1, 1, 4843.747, -587.0625, 159.7272, 0.9250245, 120, 0, 0), +(@CGUID+13, @BUNNY2, 571, 1, 1, 4789.024, -611.7726, 160.3697, 0, 120, 0, 0), +(@CGUID+14, @BUNNY2, 571, 1, 1, 4806.465, -618.2396, 159.5483, 5.445427, 120, 0, 0), +(@CGUID+15, @BUNNY2, 571, 1, 1, 4845.673, -593.6736, 159.1436, 3.874631, 120, 0, 0), +(@CGUID+16, @BUNNY2, 571, 1, 1, 4788.442, -639.3229, 162.3155, 1.37881, 120, 0, 0), +(@CGUID+17, @BUNNY2, 571, 1, 1, 4803.761, -610.7188, 159.545, 4.24115, 120, 0, 0), +(@CGUID+18, @BUNNY2, 571, 1, 1, 4793.397, -570.8108, 160.8941, 3.682645, 120, 0, 0), +(@CGUID+19, @BUNNY2, 571, 1, 1, 4809.697, -642.8246, 159.2958, 2.007129, 120, 0, 0), +(@CGUID+20, @BUNNY2, 571, 1, 1, 4790.142, -624.1771, 159.6133, 0.9773844, 120, 0, 0), +(@CGUID+21, @BUNNY2, 571, 1, 1, 4810.049, -609.3768, 159.4645, 0, 120, 0, 0), +(@CGUID+22, @BUNNY2, 571, 1, 1, 4800.022, -618.3073, 159.7944, 3.508112, 120, 0, 0), +(@CGUID+23, @BUNNY2, 571, 1, 1, 4854.851, -593.2795, 157.3008, 4.625123, 120, 0, 0), +(@CGUID+24, @BUNNY2, 571, 1, 1, 4759.741, -587.8351, 164.6121, 0, 120, 0, 0), +(@CGUID+25, @BUNNY2, 571, 1, 1, 4822.641, -641.3472, 157.8503, 3.944444, 120, 0, 0), +(@CGUID+26, @BUNNY2, 571, 1, 1, 4825.955, -637.9774, 157.6442, 5.340707, 120, 0, 0), +(@CGUID+27, @BUNNY2, 571, 1, 1, 4809.641, -555.4688, 162.6923, 0.715585, 120, 0, 0), +(@CGUID+28, @BUNNY2, 571, 1, 1, 4837.163, -576.5104, 160.5024, 5.078908, 120, 0, 0), +(@CGUID+29, @BUNNY2, 571, 1, 1, 4809.902, -635.441, 159.2038, 1.151917, 120, 0, 0), +(@CGUID+30, @BUNNY2, 571, 1, 1, 4842.37, -621.6962, 157.5227, 2.879793, 120, 0, 0), +(@CGUID+31, @BUNNY2, 571, 1, 1, 4817.919, -551.9774, 162.0828, 3.036873, 120, 0, 0), +(@CGUID+32, @BUNNY2, 571, 1, 1, 4851.638, -585.6007, 158.117, 2.059489, 120, 0, 0), +(@CGUID+33, @BUNNY2, 571, 1, 1, 4809.817, -614.8125, 159.2753, 2.199115, 120, 0, 0), +(@CGUID+34, @BUNNY2, 571, 1, 1, 4778.958, -567.7934, 162.0411, 3.647738, 120, 0, 0), +(@CGUID+35, @BUNNY2, 571, 1, 1, 4763.713, -569.2257, 163.7682, 3.839724, 120, 0, 0), +(@CGUID+36, @BUNNY2, 571, 1, 1, 4833.483, -635.0799, 157.4865, 4.834562, 120, 0, 0), +(@CGUID+37, @BUNNY2, 571, 1, 1, 4790.34, -607.0833, 160.2565, 3.525565, 120, 0, 0), +(@CGUID+38, @BUNNY2, 571, 1, 1, 4814.297, -619.2708, 158.7552, 0.715585, 120, 0, 0), +(@CGUID+39, @BUNNY2, 571, 1, 1, 4798.659, -602.0208, 159.8221, 2.565634, 120, 0, 0), +(@CGUID+40, @BUNNY2, 571, 1, 1, 4792.533, -591.684, 160.2542, 4.206244, 120, 0, 0), +(@CGUID+41, @BUNNY2, 571, 1, 1, 4789.622, -579.4358, 161.0213, 4.520403, 120, 0, 0), +(@CGUID+42, @BUNNY2, 571, 1, 1, 4797.168, -577.1268, 160.2595, 2.478368, 120, 0, 0), +(@CGUID+43, @BUNNY2, 571, 1, 1, 4800.604, -547.7327, 164.9199, 0.715585, 120, 0, 0), +(@CGUID+44, @BUNNY2, 571, 1, 1, 4784.508, -609.382, 161.722, 0, 120, 0, 0), +(@CGUID+45, @BUNNY2, 571, 1, 1, 4776.268, -596.5695, 162.6325, 2.059489, 120, 0, 0), +(@CGUID+46, @BUNNY2, 571, 1, 1, 4804.434, -635.9236, 159.8547, 0, 120, 0, 0), +(@CGUID+47, @BUNNY2, 571, 1, 1, 4772.837, -575.5347, 162.7558, 1.64061, 120, 0, 0), +(@CGUID+48, @BUNNY2, 571, 1, 1, 4797.148, -583.2952, 159.8615, 3.595378, 120, 0, 0), +(@CGUID+49, @BUNNY2, 571, 1, 1, 4806.011, -623.4809, 159.5464, 2.740167, 120, 0, 0), +(@CGUID+50, @BUNNY2, 571, 1, 1, 4848.793, -601.8837, 157.445, 4.258604, 120, 0, 0), +(@CGUID+51, 37826, 571, 1, 1, 4798.7, -639.529, 160.5693, 4.34587, 120, 0, 0), +(@CGUID+52, 37894, 571, 1, 1, 4812.028, -586.2222, 162.5564, 2.6529, 120, 0, 0); + +DELETE FROM `waypoints` WHERE `entry`IN(@LICHKING,37952); +INSERT INTO `waypoints`(`entry`, `pointid`, `position_x`, `position_y`, `position_z`, `point_comment`) VALUES +(@LICHKING, 1, 4836.363, -586.9203, 161.9295, 'The Lichking'), +(@LICHKING, 2, 4835.365, -586.868, 161.9295, 'The Lichking'), +(@LICHKING, 3, 4834.092, -586.4228, 162.2705, 'The Lichking'), +(@LICHKING, 4, 4828.495, -584.4644, 163.6633, 'The Lichking'), +(@LICHKING, 5, 4826.363, -583.7183, 164.6168, 'The Lichking'), +(@LICHKING, 6, 4825.221, -583.3187, 164.9072, 'The Lichking'), +(@LICHKING, 7, 4823.253, -582.6302, 164.3474, 'The Lichking'), +(@LICHKING, 8, 4821.647, -582.0682, 163.8447, 'The Lichking'), +(@LICHKING, 9, 4818.997, -581.1409, 163.5256, 'The Lichking'), +(@LICHKING, 10, 4814.02, -579.3994, 162.4412, 'The Lichking'), +(@LICHKING, 11, 4814.02, -579.3994, 162.4412, 'The Lichking'), +(37952, 1, 4798.7, -639.529, 160.5693, 'Lights Vengeance Vehicle Bunny 2'), +(37952, 2, 4801.055, -634.4948, 166.6768, 'Lights Vengeance Vehicle Bunny 2'), +(37952, 3, 4797, -618.7934, 171.4821, 'Lights Vengeance Vehicle Bunny 2'), +(37952, 4, 4794.907, -597.2153, 175.0993, 'Lights Vengeance Vehicle Bunny 2'), +(37952, 5, 4796.127, -576.5347, 175.0993, 'Lights Vengeance Vehicle Bunny 2'), +(37952, 6, 4808.424, -570.3871, 175.0993, 'Lights Vengeance Vehicle Bunny 2'), +(37952, 7, 4818.083, -578.1805, 175.0993, 'Lights Vengeance Vehicle Bunny 2'), +(37952, 8, 4812.49, -586.9028, 175.0993, 'Lights Vengeance Vehicle Bunny 2'); + +DELETE FROM `creature_text` WHERE `entry` IN(37976,37893,@LICHKING); +INSERT INTO `creature_text`(`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `BroadcastTextID`, `comment`) VALUES +(37976, 0, 0, 'Fear not, master. I shall rend the flesh of your enemy!', 12, 0, 100, 0, 0, 17077, 37657, 'Vegard the Unforgiven'), +(37976, 1, 0, 'Master... I have... failed.', 12, 0, 100, 0, 0, 17076, 37656, 'Vegard the Unforgiven'), +(37976, 2, 0, 'It is done, master.', 12, 0, 100, 0, 0, 17075, 37655, 'Vegard the Unforgiven'), +(37893, 0, 0, 'I hear and obey, master...', 12, 0, 100, 0, 0, 17073, 0, 'Vegard the Unforgiven'), +(37893, 1, 0, 'The enemy shall suffer greatly, master!', 12, 0, 100, 0, 0, 17074, 37651, 'Vegard the Unforgiven'), +(@LICHKING, 0, 0, 'So predictable...', 12, 0, 100, 396, 0, 17252, 37506, 'The Lich King'), +(@LICHKING, 1, 0, 'Did you truly expect to fulfill Mograine''s task unopposed?', 12, 0, 100, 6, 0, 17253, 37507, 'The Lich King'), +(@LICHKING, 2, 0, 'You both shall suffer as his father does...', 12, 0, 100, 396, 0, 17254, 37508, 'The Lich King'), +(@LICHKING, 3, 0, '...in eternal unrest!', 12, 0, 100, 0, 0, 17255, 37509, 'The Lich King'), +(@LICHKING, 4, 0, 'Die well, fool.', 12, 0, 100, 397, 0, 17256, 37510, 'The Lich King'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`IN(70590,70595,70614,70643,70612,70790,70792,70743); +INSERT INTO `conditions`(`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 70590, 0, 0, 31, 0, 3, 37826, 0, 0, 0, 0, '', 'Lich King Repel Hammer targets Lights Vengence'), +(13, 1, 70590, 0, 1, 31, 0, 3, 37827, 0, 0, 0, 0, '', 'Lich King Repel Hammer targets Lights Vengeance Vehicle Bunny'), +(13, 1, 70595, 0, 1, 31, 0, 3, @BUNNY, 0, 0, 0, 0, '', 'Lich King Repel Hammer targets Lich King Stun Bunny'), +(13, 1, 70792, 0, 0, 31, 0, 3, 37893, 0, 0, 0, 0, '', 'Kill Vegard targets Vegard the Unforgiven'), +(13, 1, 70614, 0, 0, 31, 0, 3, @BUNNY2, 0, 0, 0, 0, '', 'AoD Special targets AoD Impact Bunny'), +(13, 1, 70790, 0, 0, 31, 0, 3, 37881, 0, 0, 0, 0, '', 'Zap Ghouls targets Wretched Ghoul'), +(13, 1, 70643, 0, 0, 31, 0, 3, 37894, 0, 0, 0, 0, '', 'Zap Vegard Bunny targets Vegard Bunny'), +(13, 1, 70743, 0, 0, 31, 0, 3, @BUNNY2, 0, 0, 0, 0, '', 'AoD Special - Vegard targets AoD Impact Bunny'); + +UPDATE `gameobject_template` SET `AIName`= 'SmartGameObjectAI' WHERE`entry` IN(201844,201922,201937); + +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(201844,201922,201937) AND `source_type`=1; + +INSERT INTO `smart_scripts`(`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(201922,1,0,1,70,0,100,1,2,0,0,0,45,4,4,0,0,0,0,19,38001,0,0,0,0,0,0,"Lights Vengeance - On State Changed - Set Data 4 4 on Lights Vengeance Bunny 2"), +(201922,1,1,0,61,0,100,0,0,0,0,0,45,1,1,0,0,0,0,19,38001,0,0,0,0,0,0,"Lights Vengeance - On State Changed Set Data 1 1 on Light's Vengence Bunny 2"), +(201844,1,0,1,70,0,100,1,2,0,0,0,45,1,1,0,0,0,0,19,37952,0,0,0,0,0,0,"Lights Vengeance - On State Changed - Set Data on Lights Vengeance Vehicle Bunny 2"), +(201844,1,1,0,61,0,100,0,0,0,0,0,45,3,3,0,0,0,0,19,@BUNNY,0,0,0,0,0,0,"Lights Vengeance - On State Changed Set Data 3 3 on Lich King Stun Bunny"), +(201937,1,1,0,11,0,100,0,0,0,0,0,104,16,0,0,0,0,0,1,0,0,0,0,0,0,0,"Lights Vengeance - On Spawn - Set Non Selectable"), +(201937,1,2,0,38,0,100,0,1,1,0,0,104,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Lights Vengeance - On Data Set - Set Selectable"); + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=70653; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(70653, 70966, 1, 'Lich King Zap Player - Knockback 50 No Log'); From 97d415d1b2a429557f667f9c30e8577ab89e6434 Mon Sep 17 00:00:00 2001 From: Dr-J Date: Sun, 11 Jan 2015 13:55:29 +0000 Subject: [PATCH 14/33] DB/Misc: Additions to https://github.com/TrinityCore/TrinityCore/commit/fb1b7f66a5d959e4b080a8b25cd697c9764a098f * Prevent event from restarting if theres already an instance of either the Lich King, any of the 2 versions of vegard or the first 2 light's vengence objects already spawned * Prevent further ghouls from being summoned by same npc if there is already ghoul summoned by that npc --- sql/updates/world/2015_01_11_01_world.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 sql/updates/world/2015_01_11_01_world.sql diff --git a/sql/updates/world/2015_01_11_01_world.sql b/sql/updates/world/2015_01_11_01_world.sql new file mode 100644 index 0000000000..dca46b515b --- /dev/null +++ b/sql/updates/world/2015_01_11_01_world.sql @@ -0,0 +1,11 @@ +UPDATE `creature_template` SET `flags_extra`=0 WHERE `entry`=37826; + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceEntry` IN(37832,37878); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(22, 1, 37832, 0, 0, 29, 1, 37857, 100, 0, 1, 0, 0, '', 'Lich King Stun Bunny only Trigger if there is no spawn of the Lich King within 100 Yards'), +(22, 1, 37832, 0, 0, 29, 1, 37893, 100, 0, 1, 0, 0, '', 'Lich King Stun Bunny only Trigger if there is no spawn of Vegard within 100 Yards'), +(22, 1, 37832, 0, 0, 29, 1, 37976, 100, 0, 1, 0, 0, '', 'Lich King Stun Bunny only Trigger if there is no spawn of Vegard within 100 Yards'), +(22, 1, 37832, 0, 0, 30, 1, 201922, 100, 0, 1, 0, 0, '', 'Lich King Stun Bunny only Trigger if there is no spawn of Lights Vengence within 100 Yards'), +(22, 1, 37832, 0, 0, 30, 1, 201844, 100, 0, 1, 0, 0, '', 'Lich King Stun Bunny only Trigger if there is no spawn of Lights Vengence within 100 Yards'), +(22, 1, 37878, 0, 0, 29, 1, 37881, 2, 0, 1, 0, 0, '', 'AOD Impact Bunny only Trigger if there is no spawn of Wrethed Ghoul within 2 yards'), +(22, 2, 37878, 0, 0, 29, 1, 37881, 2, 0, 1, 0, 0, '', 'AOD Impact Bunny only Trigger if there is no spawn of Wrethed Ghoul within 2 yards'); From e0d1070851389b2699a731ac109bc5f4cd293d1c Mon Sep 17 00:00:00 2001 From: Dr-J Date: Mon, 12 Jan 2015 22:08:17 +0000 Subject: [PATCH 15/33] DB/Misc: The Sacred and the Corrupt Turn in event also a few tweaks for light's vengeance script. --- sql/updates/world/2015_01_12_00_world.sql | 76 +++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sql/updates/world/2015_01_12_00_world.sql diff --git a/sql/updates/world/2015_01_12_00_world.sql b/sql/updates/world/2015_01_12_00_world.sql new file mode 100644 index 0000000000..deaff90397 --- /dev/null +++ b/sql/updates/world/2015_01_12_00_world.sql @@ -0,0 +1,76 @@ +DELETE FROM `creature_questender` WHERE `id`=37120 AND `quest`=24545; +DELETE FROM `gameobject` WHERE `guid`=100025; + +DELETE FROM `smart_scripts` WHERE `entryorguid`=37120 AND `source_type`=0 AND `id`>1; +DELETE FROM `smart_scripts` WHERE `entryorguid`IN(3712000,3780100) AND `source_type`=9; +UPDATE `creature_template` SET `ainame`='SmartAI', `scriptname`='' WHERE `entry`IN(37702,37801,37814,38191); + +DELETE FROM `smart_scripts` WHERE `entryorguid`IN(37702,37801,37814,38191) AND `source_type`=0; + +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(37120, 0, 2, 3, 38, 0, 100, 0, 1, 1, 0, 0, 81, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - On Data Set - Set NPC Flags'), -- 23:45:40.047 +(37120, 0, 3, 7, 61, 0, 100, 0, 0, 0, 0, 0, 80, 3712000, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - On Data Set - Run Script'), +(37120, 0, 4, 5, 40, 0, 100, 0, 1, 37120, 0, 0, 66, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 5.969026, 'Highlord Darion Mograine - On Reached WP1 - Set Orientation'), +(37120, 0, 5, 0, 61, 0, 100, 0, 0, 0, 0, 0, 54, 35000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - On Reached WP1 - Pause WP'), +(37120, 0, 6, 0, 40, 0, 100, 0, 2, 37120, 0, 0, 66, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1.448623, 'Highlord Darion Mograine - On Reached WP2 - Set Orientation'), +(38191, 0, 0, 0, 11, 0, 100, 0, 0, 0, 0, 0, 53, 0, 37801, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - On Data Set - Set NPC Flags'), -- 23:45:40.047 +(37702, 0, 0, 0, 8, 0, 100, 0, 70471, 0, 0, 0, 11, 70508, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Runeforge Bunny - On Spellhit (Mograine Forge Beam) - Cast Summon Shadows Edge Bunny'), +(37702, 0, 1, 0, 38, 0, 100, 0, 1, 1, 0, 0, 11, 70367, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Runeforge Bunny - On Data Set 1 1 - Cast Forge Flame Blue'), +(37814, 0, 0, 0, 11, 0, 100, 0, 0, 0, 0, 0, 11, 46598, 0, 0, 0, 0, 0, 19, 37801, 0, 0, 0, 0, 0, 0, 'Shadows Edge Axe Bunny - On Spawn - Cast Ride Vehicle Hardcoded'), +(37801, 0, 0, 0, 11, 0, 100, 0, 0, 0, 0, 0, 80, 3780100, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Shadows Edge Bunny - On Spawn - Run Script'), +(3780100, 9, 0, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 11, 70509, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Shadows Edge Bunny - Script - Cast Blue Explosion'), -- 23:45:56.391 +(3780100, 9, 1, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 11, 70509, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Shadows Edge Bunny - Script - Cast Blue Explosion'), -- 23:45:57.610 +(3780100, 9, 2, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 11, 70509, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Shadows Edge Bunny - Script - Cast Blue Explosion'), -- 23:45:58.813 +(3780100, 9, 3, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 11, 70509, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Shadows Edge Bunny - Script - Cast Blue Explosion'), -- 23:46:00.016 +(3780100, 9, 4, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 11, 70509, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Shadows Edge Bunny - Script - Cast Blue Explosion'), -- 23:46:01.235 +(3780100, 9, 5, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 11, 70509, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Shadows Edge Bunny - Script - Cast Blue Explosion'), -- 23:46:02.453 +(3780100, 9, 6, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 11, 70504, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Shadows Edge Bunny - Script - Cast Shadows Edge Aura'), -- 23:46:03.656 +(3780100, 9, 7, 0, 0, 0, 100, 0, 0, 0, 0, 0, 12, 38191, 1, 24000, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Shadows Edge Bunny - Script - Summon Shadows Edge'), +(3780100, 9, 8, 0, 0, 0, 100, 0, 3000, 3000, 0, 0, 53, 0, 37801, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Shadows Edge Bunny - Script - Start WP'), -- 23:46:06.110 +(3780100, 9, 9, 0, 0, 0, 100, 0, 13000, 13000, 0, 0, 11, 70529, 0, 0, 0, 0, 0, 19, 38191, 0, 0, 0, 0, 0, 0, 'Shadows Edge Bunny - Script - Cast Shadows Edge Axe'), -- 23:46:19.438 +(3780100, 9, 10, 0, 0, 0, 100, 0, 8000, 8000, 0, 0, 41, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Shadows Edge Bunny - Script - Despawn'), +(3712000, 9, 0, 0, 0, 0, 100, 0, 2000, 2000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - Script - Say Line 0'), -- 23:45:42.594 +(3712000, 9, 1, 0, 0, 0, 100, 0, 3000, 3000, 0, 0, 53, 0, 37120, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - Script - Start WP'), -- 23:45:42.594 +(3712000, 9, 2, 0, 0, 0, 100, 0, 7000, 7000, 0, 0, 11, 70471, 0, 0, 0, 0, 0, 19, 37702, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - Script - Cast Mograine Forge Beam'), -- 23:45:49.906 +(3712000, 9, 3, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - Script - Say Line 1'), -- 23:45:50.125 +(3712000, 9, 4, 0, 0, 0, 100, 0, 17000, 17000, 0, 0, 1, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - Script - Say Line 2'), -- 23:46:07.125 +(3712000, 9, 5, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 45, 1, 1, 0, 0, 0, 0, 19, 37702, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - Script - Set Data on Runeforge Bunny'), -- 23:46:08.000 +(3712000, 9, 6, 0, 0, 0, 100, 0, 5000, 5000, 0, 0, 1, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - Script - Say Line 3'), -- 23:46:13.156 +(3712000, 9, 7, 0, 0, 0, 100, 0, 12000, 12000, 0, 0, 11, 71310, 0, 0, 0, 0, 0, 19, 38191, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - Script - Cast Pull Shadows Edge'), -- 23:46:25.094 +(3712000, 9, 8, 0, 0, 0, 100, 0, 0, 0, 0, 0, 81, 3, 0, 0, 0, 0, 0, 19, 38191, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - Script - Set NPC Flags'), -- 23:46:25.094 +(3712000, 9, 9, 0, 0, 0, 100, 0, 150, 150, 0, 0, 11, 43671, 0, 0, 0, 0, 0, 19, 38191, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - Script - Cast Ride Vehicle'), -- 23:46:25.110 +(3712000, 9, 10, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 11, 71385, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - Script - Cast Mograine Axe Timer Aura'), -- 23:46:26.328 +(3712000, 9, 11, 0, 0, 0, 100, 0, 0, 1000, 0, 0, 81, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Highlord Darion Mograine - Script - Cast Mograine Axe Timer Aura'); -- 23:46:26.328 + + +DELETE FROM `creature_text` WHERE `entry`in(37120); +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `BroadcastTextID`, `comment`) VALUES +(37120, 0, 0, 'So, it has begun....', 12, 0, 100, 396, 0, 16834, 37248, 'Highlord Darion Mograine to Player'), +(37120, 1, 0, 'Behold! The binding of sacred and corrupt; the forging of Shadow''s Edge, a weapon of untold potential!', 12, 0, 100, 0, 0, 16835, 37249, 'Highlord Darion Mograine to Player'), +(37120, 2, 0, 'Bend it to your will, and you shall wield unspeakable power!', 12, 0, 100, 396, 0, 16836, 37250, 'Highlord Darion Mograine to Player'), +(37120, 3, 0, 'Fail, and your soul shall forever be its slave.', 12, 0, 100, 396, 0, 16837, 37251, 'Highlord Darion Mograine to Player'); + +DELETE FROM `waypoints` WHERE `entry`IN(37120,37801); +INSERT INTO `waypoints`(`entry`, `pointid`, `position_x`, `position_y`, `position_z`, `point_comment`) VALUES +(37120, 1, -67.52431, 2161.191, 30.65416, 'Highlord Darion Mograine'), +(37120, 2, -69.84028, 2155.585, 30.65416, 'Highlord Darion Mograine'), +(37801, 1, -62.15451, 2157.793, 31.59859, 'Shadows Edge Bunny'), +(37801, 2, -69.53472, 2159.691, 31.79306, 'Shadows Edge Bunny'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceEntry`IN(5650); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(22, 1, 5650, 2, 0, 9, 0, 24545, 0, 0, 0, 0, 0, '', 'Trigger only activates if player is on and has not completed The Sacred and the Corrupt'), +(22, 1, 5650, 2, 0, 2, 0, 49869, 1, 0, 1, 0, 0, '', 'Trigger does not activate if player already has lights vengence'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`IN(70529,71310,70471); +INSERT INTO `conditions`(`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 70529, 0, 0, 31, 0, 3, 38191, 0, 0, 0, 0, '', 'Summon Shadows Edge Axe targets Shadows Edge'), +(13, 3, 71310, 0, 0, 31, 0, 3, 38191, 0, 0, 0, 0, '', 'Pull Shadows Edge targets Shadows Edge'), +(13, 3, 70471, 0, 0, 31, 0, 3, 37702, 0, 0, 0, 0, '', ' Mograine Forge Beam targets Runeforge Bunny'); + +UPDATE `gameobject_template` SET `AIName`= 'SmartGameObjectAI' WHERE`entry` IN(201742); + +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(201742) AND `source_type`=1; + +INSERT INTO `smart_scripts`(`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(201742,1,0,0,20,0,100,0,24545,0,0,0,45,1,1,0,0,0,0,19,37120,0,0,0,0,0,0,"RuneForge - On Quest Reward (the Sacred and the Corrupt) - Set Data 1 1 on Highlord Darion Mograine"); From e0a07574d19173f25ae9fc557c58bfd8479a43d0 Mon Sep 17 00:00:00 2001 From: Aokromes Date: Tue, 13 Jan 2015 20:53:07 +0100 Subject: [PATCH 16/33] DB/Waypoint: Update several npc's move_type for running npc's By Kittnz, closes #13888 --- sql/updates/world/2015_01_12_01_world.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 sql/updates/world/2015_01_12_01_world.sql diff --git a/sql/updates/world/2015_01_12_01_world.sql b/sql/updates/world/2015_01_12_01_world.sql new file mode 100644 index 0000000000..c5513f01c1 --- /dev/null +++ b/sql/updates/world/2015_01_12_01_world.sql @@ -0,0 +1,2 @@ +-- +UPDATE `waypoint_data` SET `move_type`=1 WHERE `id` IN (579650,1112180,992280,992270,992300); From 8197da743cd5a9a2c4df73e53b9f9dc44cbec1d5 Mon Sep 17 00:00:00 2001 From: Aokromes Date: Tue, 13 Jan 2015 20:57:04 +0100 Subject: [PATCH 17/33] DB/Creature: Add Corvax & Rook spawns and waypoints By Kittnz, closes #13826 --- sql/updates/world/2015_01_12_02_world.sql | 49 +++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 sql/updates/world/2015_01_12_02_world.sql diff --git a/sql/updates/world/2015_01_12_02_world.sql b/sql/updates/world/2015_01_12_02_world.sql new file mode 100644 index 0000000000..154c6e2596 --- /dev/null +++ b/sql/updates/world/2015_01_12_02_world.sql @@ -0,0 +1,49 @@ +-- Add missing spawns Rook and Corvax +SET @GUID := 69711; +INSERT INTO `creature` (`guid`, `id`, `map`, `modelid`, `position_x`, `position_y`, `position_z`, `orientation`, `curhealth`) VALUES +(@GUID + 0, 22843, 530, 21119, -237.2198, 5444.96, 31.853, 2.59318, 4059), +(@GUID + 1, 22842, 530, 21119, -254.8032, 5443.792, 30.77559, 0.6263401, 50); + +-- Update InhabitType for flying +UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry`=22843; +UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry`=22842; + +-- Pathing for Rook Entry: 22843 'TDB FORMAT' +SET @NPC := 69711; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=-253.4223,`position_y`=5430.909,`position_z`=28.92926 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES (@NPC,@PATH,0,0,1,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_type`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,-253.4223,5430.909,28.92926,0,0,1,0,100,0), +(@PATH,2,-252.2368,5429.647,28.75794,0,0,1,0,100,0), +(@PATH,3,-246.0865,5428.435,29.54239,0,0,1,0,100,0), +(@PATH,4,-239.4053,5431.095,29.54241,0,0,1,0,100,0), +(@PATH,5,-235.5483,5436.207,30.90352,0,0,1,0,100,0), +(@PATH,6,-235.0203,5442.249,30.87573,0,0,1,0,100,0), +(@PATH,7,-238.777,5445.627,32.07018,0,0,1,0,100,0), +(@PATH,8,-246.5504,5445.43,30.82018,0,0,1,0,100,0), +(@PATH,9,-254.3803,5440.281,29.67928,0,0,1,0,100,0), +(@PATH,10,-255.2896,5432.612,28.92926,0,0,1,0,100,0); +-- 0x1C39204240164EC000002C00001A411E .go -253.4223 5430.909 28.92926 + +-- Pathing for Corvax Entry: 22842 'TDB FORMAT' +SET @NPC := 69712; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=-231.4784,`position_y`=5442.248,`position_z`=29.75438 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES (@NPC,@PATH,0,0,1,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_type`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,-231.4784,5442.248,29.75438,0,0,1,0,100,0), +(@PATH,2,-231.9071,5441.805,29.40595,0,0,1,0,100,0), +(@PATH,3,-233.5468,5436.123,30.58605,0,0,1,0,100,0), +(@PATH,4,-235.9648,5433.313,31.33606,0,0,1,0,100,0), +(@PATH,5,-245.6634,5430.377,32.44696,0,0,1,0,100,0), +(@PATH,6,-254.214,5432.43,32.50253,0,0,1,0,100,0), +(@PATH,7,-257.6299,5440.645,31.36549,0,0,1,0,100,0), +(@PATH,8,-250.052,5446.799,30.14325,0,0,1,0,100,0), +(@PATH,9,-244.9603,5449.014,29.67106,0,0,1,0,100,0), +(@PATH,10,-237.6145,5448.882,29.75438,0,0,1,0,100,0); +-- 0x1C39204240164E8000002C00001A411E .go -231.4784 5442.248 29.75438 From 03a5d6d0c985cae8c1683e4ad8e8bbd6185fd896 Mon Sep 17 00:00:00 2001 From: Unholychick Date: Mon, 12 Jan 2015 19:28:21 +0100 Subject: [PATCH 18/33] Core/Spells: Use BonusAmount for periodic damage Closes #13887 --- .../game/Spells/Auras/SpellAuraEffects.cpp | 43 ++++++++++++------- .../game/Spells/Auras/SpellAuraEffects.h | 6 +-- src/server/game/Spells/Auras/SpellAuras.cpp | 20 ++------- src/server/scripts/Spells/spell_dk.cpp | 4 +- src/server/scripts/Spells/spell_hunter.cpp | 7 +-- src/server/scripts/Spells/spell_priest.cpp | 4 +- src/server/scripts/Spells/spell_warlock.cpp | 4 +- src/server/scripts/Spells/spell_warrior.cpp | 2 +- 8 files changed, 41 insertions(+), 49 deletions(-) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 6cd4d79cf5..e5b8cd111b 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -379,7 +379,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= AuraEffect::AuraEffect(Aura* base, uint8 effIndex, int32 *baseAmount, Unit* caster): m_base(base), m_spellInfo(base->GetSpellInfo()), m_baseAmount(baseAmount ? *baseAmount : m_spellInfo->Effects[effIndex].BasePoints), -m_damage(0), m_critChance(0.0f), m_donePct(1.0f), +m_bonusAmount(0), m_critChance(0.0f), m_donePct(1.0f), m_spellmod(NULL), m_periodicTimer(0), m_tickNumber(0), m_effIndex(effIndex), m_canBeRecalculated(true), m_isPeriodic(false) { @@ -5834,16 +5834,18 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const // AOE spells are not affected by the new periodic system. bool isAreaAura = m_spellInfo->Effects[m_effIndex].IsAreaAuraEffect() || m_spellInfo->Effects[m_effIndex].IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA); // ignore negative values (can be result apply spellmods to aura damage - uint32 damage = isAreaAura ? std::max(GetAmount(), 0) : m_damage; + uint32 damage = std::max(GetAmount() + GetBonusAmount(), 0); // if isAreaAura == true, GetBonusAmount == 0. // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations - if (isAreaAura) - sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage); + sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage); if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE) { if (isAreaAura) damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()) * caster->SpellDamagePctDone(target, m_spellInfo, DOT); + else + damage = std::max(int32(damage * GetDonePct()), 0); + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); // Calculate armor mitigation @@ -5910,7 +5912,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const bool crit = false; if (CanPeriodicTickCrit(caster)) - crit = roll_chance_f(isAreaAura ? caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()) : m_critChance); + crit = roll_chance_f(isAreaAura ? caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()) : GetCritChance()); if (crit) damage = caster->SpellCriticalDamageBonus(m_spellInfo, damage, target); @@ -5968,14 +5970,16 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c bool isAreaAura = m_spellInfo->Effects[m_effIndex].IsAreaAuraEffect() || m_spellInfo->Effects[m_effIndex].IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA); // ignore negative values (can be result apply spellmods to aura damage - uint32 damage = isAreaAura ? std::max(GetAmount(), 0) : m_damage; + uint32 damage = std::max(GetAmount() + GetBonusAmount(), 0); // if isAreaAura == true, GetBonusAmount == 0. + + // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations + sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage); if (isAreaAura) - { - // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations - sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage); damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()) * caster->SpellDamagePctDone(target, m_spellInfo, DOT); - } + else + damage = std::max(int32(damage * GetDonePct()), 0); + damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); // Calculate armor mitigation @@ -5989,15 +5993,15 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c if (!(m_spellInfo->AttributesEx4 & SPELL_ATTR4_FIXED_DAMAGE)) if (m_spellInfo->Effects[m_effIndex].IsTargetingArea() || isAreaAura) { - damage = int32(float(damage) * target->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask)); + damage = uint32(float(damage) * target->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask)); if (caster->GetTypeId() != TYPEID_PLAYER) - damage = int32(float(damage) * target->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask)); + damage = uint32(float(damage) * target->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask)); } bool crit = false; if (CanPeriodicTickCrit(caster)) - crit = roll_chance_f(isAreaAura ? caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()) : m_critChance); + crit = roll_chance_f(isAreaAura ? caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()) : GetCritChance()); if (crit) damage = caster->SpellCriticalDamageBonus(m_spellInfo, damage, target); @@ -6088,7 +6092,10 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const bool isAreaAura = m_spellInfo->Effects[m_effIndex].IsAreaAuraEffect() || m_spellInfo->Effects[m_effIndex].IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA); // ignore negative values (can be result apply spellmods to aura damage - int32 damage = isAreaAura ? std::max(GetAmount(), 0) : m_damage; + uint32 damage = std::max(GetAmount() + GetBonusAmount(), 0); // if isAreaAura == true, GetBonusAmount == 0. + + // Script Hook For HandlePeriodicHealAurasTick -- Allow scripts to change the Damage pre class mitigation calculations + sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage); if (GetAuraType() == SPELL_AURA_OBS_MOD_HEALTH) { @@ -6136,15 +6143,19 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const damage += addition; } + if (isAreaAura) damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()) * caster->SpellHealingPctDone(target, m_spellInfo); + else + damage = std::max(int32(damage * GetDonePct()), 0); + damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); } bool crit = false; if (CanPeriodicTickCrit(caster)) - crit = roll_chance_f(isAreaAura ? caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()) : m_critChance); + crit = roll_chance_f(isAreaAura ? caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()) : GetCritChance()); if (crit) damage = caster->SpellCriticalHealingBonus(m_spellInfo, damage, target); @@ -6153,7 +6164,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), damage, GetId()); uint32 absorb = 0; - uint32 heal = uint32(damage); + uint32 heal = damage; caster->CalcHealAbsorb(target, GetSpellInfo(), heal, absorb); int32 gain = caster->DealHeal(target, heal); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 3ee52b01e1..753d16a97e 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -70,8 +70,8 @@ class AuraEffect void HandleEffect(Unit* target, uint8 mode, bool apply); void ApplySpellMod(Unit* target, bool apply); - void SetDamage(int32 val) { m_damage = val; } - int32 GetDamage() const { return m_damage; } + void SetBonusAmount(int32 val) { m_bonusAmount = val; } + int32 GetBonusAmount() const { return m_bonusAmount; } void SetCritChance(float val) { m_critChance = val; } float GetCritChance() const { return m_critChance; } void SetDonePct(float val) { m_donePct = val; } @@ -105,7 +105,7 @@ class AuraEffect int32 const m_baseAmount; int32 m_amount; - int32 m_damage; + int32 m_bonusAmount; float m_critChance; float m_donePct; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index d4cc2af6ce..93a4c96b92 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1705,14 +1705,8 @@ void Aura::HandleAuraSpecificPeriodics(AuraApplication const* aurApp, Unit* cast { AuraEffect* aurEff = GetEffect(i); - // ignore non positive values (can be result apply spellmods to aura damage - uint32 damage = std::max(aurEff->GetAmount(), 0); - - // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations - sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage); - - aurEff->SetDonePct(caster->SpellDamagePctDone(target, m_spellInfo, DOT)); // Calculate done percentage first! - aurEff->SetDamage(caster->SpellDamageBonusDone(target, m_spellInfo, damage, DOT, GetStackAmount()) * aurEff->GetDonePct()); + aurEff->SetDonePct(caster->SpellDamagePctDone(target, m_spellInfo, DOT)); + aurEff->SetBonusAmount(caster->SpellDamageBonusDone(target, m_spellInfo, 0, DOT, GetStackAmount())); aurEff->SetCritChance(caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask())); break; } @@ -1721,14 +1715,8 @@ void Aura::HandleAuraSpecificPeriodics(AuraApplication const* aurApp, Unit* cast { AuraEffect* aurEff = GetEffect(i); - // ignore non positive values (can be result apply spellmods to aura damage - uint32 damage = std::max(aurEff->GetAmount(), 0); - - // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations - sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage); - - aurEff->SetDonePct(caster->SpellHealingPctDone(target, m_spellInfo)); // Calculate done percentage first! - aurEff->SetDamage(caster->SpellHealingBonusDone(target, m_spellInfo, damage, DOT, GetStackAmount()) * aurEff->GetDonePct()); + aurEff->SetDonePct(caster->SpellHealingPctDone(target, m_spellInfo)); + aurEff->SetBonusAmount(caster->SpellHealingBonusDone(target, m_spellInfo, 0, DOT, GetStackAmount())); aurEff->SetCritChance(caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask())); break; } diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 67ce1485a8..cd0052c24b 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -1067,7 +1067,7 @@ class spell_dk_pestilence : public SpellScriptLoader { aurEffNew->SetCritChance(critChance); // Blood Plague can crit if caster has T9. aurEffNew->SetDonePct(donePct); - aurEffNew->SetDamage(caster->SpellDamageBonusDone(hitUnit, aurEffNew->GetSpellInfo(), std::max(aurEffNew->GetAmount(), 0), DOT) * donePct); + aurEffNew->SetBonusAmount(caster->SpellDamageBonusDone(hitUnit, aurEffNew->GetSpellInfo(), 0, DOT)); } } } @@ -1086,7 +1086,7 @@ class spell_dk_pestilence : public SpellScriptLoader if (AuraEffect* aurEffNew = aurNew->GetEffect(EFFECT_0)) { aurEffNew->SetDonePct(donePct); - aurEffNew->SetDamage(caster->SpellDamageBonusDone(hitUnit, aurEffNew->GetSpellInfo(), std::max(aurEffNew->GetAmount(), 0), DOT) * donePct); + aurEffNew->SetBonusAmount(caster->SpellDamageBonusDone(hitUnit, aurEffNew->GetSpellInfo(), 0, DOT)); } } } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 8a6e191f8a..3ee337f81d 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -209,14 +209,11 @@ class spell_hun_chimera_shot : public SpellScriptLoader { int32 TickCount = aurEff->GetTotalTicks(); spellId = SPELL_HUNTER_CHIMERA_SHOT_SERPENT; - basePoint = aurEff->GetDamage(); + basePoint = (aurEff->GetAmount() + aurEff->GetBonusAmount()) * aurEff->GetDonePct(); ApplyPct(basePoint, TickCount * 40); basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount()); - // Recalculate bonus damage on roll. - uint32 damage = std::max(aurEff->GetAmount(), 0); - sScriptMgr->ModifyPeriodicDamageAurasTick(unitTarget, caster, damage); - aurEff->SetDamage(caster->SpellDamageBonusDone(unitTarget, aurEff->GetSpellInfo(), damage, DOT) * aurEff->GetDonePct()); + aurEff->SetBonusAmount(caster->SpellDamageBonusDone(unitTarget, aurEff->GetSpellInfo(), 0, DOT)); } // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting. else if (familyFlag[1] & 0x00000080) diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 0ead78a2ec..0914089f1c 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -544,9 +544,7 @@ class spell_pri_pain_and_suffering_proc : public SpellScriptLoader if (Unit* target = GetHitUnit()) if (AuraEffect* aur = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, caster->GetGUID())) { - uint32 damage = std::max(aur->GetAmount(), 0); - sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage); - aur->SetDamage(caster->SpellDamageBonusDone(target, aur->GetSpellInfo(), damage, DOT) * aur->GetDonePct()); + aur->SetBonusAmount(caster->SpellDamageBonusDone(target, aur->GetSpellInfo(), 0, DOT)); aur->CalculatePeriodic(caster, false, false); aur->GetBase()->RefreshDuration(); } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 6105a0d8be..a2bbfdc246 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -411,9 +411,7 @@ class spell_warl_everlasting_affliction : public SpellScriptLoader // Refresh corruption on target if (AuraEffect* aur = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x2, 0, 0, caster->GetGUID())) { - uint32 damage = std::max(aur->GetAmount(), 0); - sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage); - aur->SetDamage(caster->SpellDamageBonusDone(target, aur->GetSpellInfo(), damage, DOT) * aur->GetDonePct()); + aur->SetBonusAmount(caster->SpellDamageBonusDone(target, aur->GetSpellInfo(), 0, DOT)); aur->CalculatePeriodic(caster, false, false); aur->GetBase()->RefreshDuration(true); } diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index ea519abebd..fa2b323e22 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -275,7 +275,7 @@ class spell_warr_deep_wounds : public SpellScriptLoader // Add remaining ticks to damage done if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC, EFFECT_0, caster->GetGUID())) - damage += aurEff->GetDamage() * int32(ticks - aurEff->GetTickNumber()); + damage += (aurEff->GetAmount() + aurEff->GetBonusAmount()) * aurEff->GetDonePct() * int32(ticks - aurEff->GetTickNumber()); damage /= int32(ticks); From 4874c9fc7892d1c9596ab6de12d40e55b5d65355 Mon Sep 17 00:00:00 2001 From: Dr-J Date: Fri, 16 Jan 2015 23:01:24 +0000 Subject: [PATCH 19/33] DB/Misc: Tabard Vendors Replicate script on Elizabeth Ross to other tabard vendors as previously only Elizabeth Ross would replace lost tabards. --- sql/updates/world/ 2015_01_16_00_world.sql | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 sql/updates/world/ 2015_01_16_00_world.sql diff --git a/sql/updates/world/ 2015_01_16_00_world.sql b/sql/updates/world/ 2015_01_16_00_world.sql new file mode 100644 index 0000000000..9c3642d4d8 --- /dev/null +++ b/sql/updates/world/ 2015_01_16_00_world.sql @@ -0,0 +1,83 @@ +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry` IN(16766,16610,5188,5189,5190,5191,5049); +UPDATE `creature_template` SET `gossip_menu_id`=9832 WHERE `entry`= IN(5188,5049,5191); + +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(16766,16610,5188,5189,5190,5191,5049); + +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(16766, 0, 10, 0, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Issca - On Gossip Option 10 Selected - Close Gossip'), +(16766, 0, 0, 10, 62, 0, 100, 0, 9832, 1, 0, 0, 11, 54974, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Issca - On Gossip Option 1 Selected - Cast \'Create Blood Knight Tabard\''), +(16766, 0, 1, 10, 62, 0, 100, 0, 9832, 2, 0, 0, 11, 54976, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Issca - On Gossip Option 2 Selected - Cast \'Create Tabard of the Hand\''), +(16766, 0, 2, 10, 62, 0, 100, 0, 9832, 3, 0, 0, 11, 55008, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Issca - On Gossip Option 3 Selected - Cast \'Create Tabard of the Protector\''), +(16766, 0, 3, 10, 62, 0, 100, 0, 9832, 4, 0, 0, 11, 54977, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Issca - On Gossip Option 4 Selected - Cast \'Create Green Trophy Tabard of the Illidari\''), +(16766, 0, 4, 10, 62, 0, 100, 0, 9832, 5, 0, 0, 11, 54982, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Issca - On Gossip Option 5 Selected - Cast \'Create Purple Trophy Tabard of the Illidari\''), +(16766, 0, 5, 10, 62, 0, 100, 0, 9832, 6, 0, 0, 11, 62768, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Issca - On Gossip Option 6 Selected - Cast \'Create Tabard of Summer Skies\''), +(16766, 0, 6, 10, 62, 0, 100, 0, 9832, 7, 0, 0, 11, 62769, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Issca - On Gossip Option 7 Selected - Cast \'Create Tabard of Summer Flames\''), +(16766, 0, 7, 10, 62, 0, 100, 0, 9832, 8, 0, 0, 11, 58194, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Issca - On Gossip Option 8 Selected - Cast \'Create Loremaster\'s Colors\''), +(16766, 0, 8, 10, 62, 0, 100, 0, 9832, 9, 0, 0, 11, 58224, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Issca - On Gossip Option 9 Selected - Cast \'Create Tabard of the Explorer\''), +(16766, 0, 9, 10, 62, 0, 100, 0, 9832, 10, 0, 0, 11, 55006, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Issca - On Gossip Option 10 Selected - Cast \'Create Tabard of the Achiever\''), +(16610, 0, 10, 0, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Kredis - On Gossip Option 10 Selected - Close Gossip'), +(16610, 0, 0, 10, 62, 0, 100, 0, 9832, 1, 0, 0, 11, 54974, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Kredis - On Gossip Option 1 Selected - Cast \'Create Blood Knight Tabard\''), +(16610, 0, 1, 10, 62, 0, 100, 0, 9832, 2, 0, 0, 11, 54976, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Kredis - On Gossip Option 2 Selected - Cast \'Create Tabard of the Hand\''), +(16610, 0, 2, 10, 62, 0, 100, 0, 9832, 3, 0, 0, 11, 55008, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Kredis - On Gossip Option 3 Selected - Cast \'Create Tabard of the Protector\''), +(16610, 0, 3, 10, 62, 0, 100, 0, 9832, 4, 0, 0, 11, 54977, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Kredis - On Gossip Option 4 Selected - Cast \'Create Green Trophy Tabard of the Illidari\''), +(16610, 0, 4, 10, 62, 0, 100, 0, 9832, 5, 0, 0, 11, 54982, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Kredis - On Gossip Option 5 Selected - Cast \'Create Purple Trophy Tabard of the Illidari\''), +(16610, 0, 5, 10, 62, 0, 100, 0, 9832, 6, 0, 0, 11, 62768, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Kredis - On Gossip Option 6 Selected - Cast \'Create Tabard of Summer Skies\''), +(16610, 0, 6, 10, 62, 0, 100, 0, 9832, 7, 0, 0, 11, 62769, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Kredis - On Gossip Option 7 Selected - Cast \'Create Tabard of Summer Flames\''), +(16610, 0, 7, 10, 62, 0, 100, 0, 9832, 8, 0, 0, 11, 58194, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Kredis - On Gossip Option 8 Selected - Cast \'Create Loremaster\'s Colors\''), +(16610, 0, 8, 10, 62, 0, 100, 0, 9832, 9, 0, 0, 11, 58224, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Kredis - On Gossip Option 9 Selected - Cast \'Create Tabard of the Explorer\''), +(16610, 0, 9, 10, 62, 0, 100, 0, 9832, 10, 0, 0, 11, 55006, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Kredis - On Gossip Option 10 Selected - Cast \'Create Tabard of the Achiever\''), +(5190, 0, 10, 0, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Merill Pleasance - On Gossip Option 10 Selected - Close Gossip'), +(5190, 0, 0, 10, 62, 0, 100, 0, 9832, 1, 0, 0, 11, 54974, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Merill Pleasance - On Gossip Option 1 Selected - Cast \'Create Blood Knight Tabard\''), +(5190, 0, 1, 10, 62, 0, 100, 0, 9832, 2, 0, 0, 11, 54976, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Merill Pleasance - On Gossip Option 2 Selected - Cast \'Create Tabard of the Hand\''), +(5190, 0, 2, 10, 62, 0, 100, 0, 9832, 3, 0, 0, 11, 55008, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Merill Pleasance - On Gossip Option 3 Selected - Cast \'Create Tabard of the Protector\''), +(5190, 0, 3, 10, 62, 0, 100, 0, 9832, 4, 0, 0, 11, 54977, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Merill Pleasance - On Gossip Option 4 Selected - Cast \'Create Green Trophy Tabard of the Illidari\''), +(5190, 0, 4, 10, 62, 0, 100, 0, 9832, 5, 0, 0, 11, 54982, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Merill Pleasance - On Gossip Option 5 Selected - Cast \'Create Purple Trophy Tabard of the Illidari\''), +(5190, 0, 5, 10, 62, 0, 100, 0, 9832, 6, 0, 0, 11, 62768, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Merill Pleasance - On Gossip Option 6 Selected - Cast \'Create Tabard of Summer Skies\''), +(5190, 0, 6, 10, 62, 0, 100, 0, 9832, 7, 0, 0, 11, 62769, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Merill Pleasance - On Gossip Option 7 Selected - Cast \'Create Tabard of Summer Flames\''), +(5190, 0, 7, 10, 62, 0, 100, 0, 9832, 8, 0, 0, 11, 58194, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Merill Pleasance - On Gossip Option 8 Selected - Cast \'Create Loremaster\'s Colors\''), +(5190, 0, 8, 10, 62, 0, 100, 0, 9832, 9, 0, 0, 11, 58224, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Merill Pleasance - On Gossip Option 9 Selected - Cast \'Create Tabard of the Explorer\''), +(5190, 0, 9, 10, 62, 0, 100, 0, 9832, 10, 0, 0, 11, 55006, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Merill Pleasance - On Gossip Option 10 Selected - Cast \'Create Tabard of the Achiever\''), +(5189, 0, 10, 0, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Thrumn - On Gossip Option 10 Selected - Close Gossip'), +(5189, 0, 0, 10, 62, 0, 100, 0, 9832, 1, 0, 0, 11, 54974, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Thrumn - On Gossip Option 1 Selected - Cast \'Create Blood Knight Tabard\''), +(5189, 0, 1, 10, 62, 0, 100, 0, 9832, 2, 0, 0, 11, 54976, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Thrumn - On Gossip Option 2 Selected - Cast \'Create Tabard of the Hand\''), +(5189, 0, 2, 10, 62, 0, 100, 0, 9832, 3, 0, 0, 11, 55008, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Thrumn - On Gossip Option 3 Selected - Cast \'Create Tabard of the Protector\''), +(5189, 0, 3, 10, 62, 0, 100, 0, 9832, 4, 0, 0, 11, 54977, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Thrumn - On Gossip Option 4 Selected - Cast \'Create Green Trophy Tabard of the Illidari\''), +(5189, 0, 4, 10, 62, 0, 100, 0, 9832, 5, 0, 0, 11, 54982, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Thrumn - On Gossip Option 5 Selected - Cast \'Create Purple Trophy Tabard of the Illidari\''), +(5189, 0, 5, 10, 62, 0, 100, 0, 9832, 6, 0, 0, 11, 62768, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Thrumn - On Gossip Option 6 Selected - Cast \'Create Tabard of Summer Skies\''), +(5189, 0, 6, 10, 62, 0, 100, 0, 9832, 7, 0, 0, 11, 62769, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Thrumn - On Gossip Option 7 Selected - Cast \'Create Tabard of Summer Flames\''), +(5189, 0, 7, 10, 62, 0, 100, 0, 9832, 8, 0, 0, 11, 58194, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Thrumn - On Gossip Option 8 Selected - Cast \'Create Loremaster\'s Colors\''), +(5189, 0, 8, 10, 62, 0, 100, 0, 9832, 9, 0, 0, 11, 58224, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Thrumn - On Gossip Option 9 Selected - Cast \'Create Tabard of the Explorer\''), +(5189, 0, 9, 10, 62, 0, 100, 0, 9832, 10, 0, 0, 11, 55006, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Thrumn - On Gossip Option 10 Selected - Cast \'Create Tabard of the Achiever\''), +(5188, 0, 10, 0, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Garyl - On Gossip Option 10 Selected - Close Gossip'), +(5188, 0, 0, 10, 62, 0, 100, 0, 9832, 1, 0, 0, 11, 54974, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Garyl - On Gossip Option 1 Selected - Cast \'Create Blood Knight Tabard\''), +(5188, 0, 1, 10, 62, 0, 100, 0, 9832, 2, 0, 0, 11, 54976, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Garyl - On Gossip Option 2 Selected - Cast \'Create Tabard of the Hand\''), +(5188, 0, 2, 10, 62, 0, 100, 0, 9832, 3, 0, 0, 11, 55008, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Garyl - On Gossip Option 3 Selected - Cast \'Create Tabard of the Protector\''), +(5188, 0, 3, 10, 62, 0, 100, 0, 9832, 4, 0, 0, 11, 54977, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Garyl - On Gossip Option 4 Selected - Cast \'Create Green Trophy Tabard of the Illidari\''), +(5188, 0, 4, 10, 62, 0, 100, 0, 9832, 5, 0, 0, 11, 54982, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Garyl - On Gossip Option 5 Selected - Cast \'Create Purple Trophy Tabard of the Illidari\''), +(5188, 0, 5, 10, 62, 0, 100, 0, 9832, 6, 0, 0, 11, 62768, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Garyl - On Gossip Option 6 Selected - Cast \'Create Tabard of Summer Skies\''), +(5188, 0, 6, 10, 62, 0, 100, 0, 9832, 7, 0, 0, 11, 62769, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Garyl - On Gossip Option 7 Selected - Cast \'Create Tabard of Summer Flames\''), +(5188, 0, 7, 10, 62, 0, 100, 0, 9832, 8, 0, 0, 11, 58194, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Garyl - On Gossip Option 8 Selected - Cast \'Create Loremaster\'s Colors\''), +(5188, 0, 8, 10, 62, 0, 100, 0, 9832, 9, 0, 0, 11, 58224, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Garyl - On Gossip Option 9 Selected - Cast \'Create Tabard of the Explorer\''), +(5188, 0, 9, 10, 62, 0, 100, 0, 9832, 10, 0, 0, 11, 55006, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Garyl - On Gossip Option 10 Selected - Cast \'Create Tabard of the Achiever\''), +(5049, 0, 10, 0, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Lyesa Steelbrow - On Gossip Option 10 Selected - Close Gossip'), +(5049, 0, 0, 10, 62, 0, 100, 0, 9832, 1, 0, 0, 11, 54974, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Lyesa Steelbrow - On Gossip Option 1 Selected - Cast \'Create Blood Knight Tabard\''), +(5049, 0, 1, 10, 62, 0, 100, 0, 9832, 2, 0, 0, 11, 54976, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Lyesa Steelbrow - On Gossip Option 2 Selected - Cast \'Create Tabard of the Hand\''), +(5049, 0, 2, 10, 62, 0, 100, 0, 9832, 3, 0, 0, 11, 55008, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Lyesa Steelbrow - On Gossip Option 3 Selected - Cast \'Create Tabard of the Protector\''), +(5049, 0, 3, 10, 62, 0, 100, 0, 9832, 4, 0, 0, 11, 54977, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Lyesa Steelbrow - On Gossip Option 4 Selected - Cast \'Create Green Trophy Tabard of the Illidari\''), +(5049, 0, 4, 10, 62, 0, 100, 0, 9832, 5, 0, 0, 11, 54982, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Lyesa Steelbrow - On Gossip Option 5 Selected - Cast \'Create Purple Trophy Tabard of the Illidari\''), +(5049, 0, 5, 10, 62, 0, 100, 0, 9832, 6, 0, 0, 11, 62768, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Lyesa Steelbrow - On Gossip Option 6 Selected - Cast \'Create Tabard of Summer Skies\''), +(5049, 0, 6, 10, 62, 0, 100, 0, 9832, 7, 0, 0, 11, 62769, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Lyesa Steelbrow - On Gossip Option 7 Selected - Cast \'Create Tabard of Summer Flames\''), +(5049, 0, 7, 10, 62, 0, 100, 0, 9832, 8, 0, 0, 11, 58194, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Lyesa Steelbrow - On Gossip Option 8 Selected - Cast \'Create Loremaster\'s Colors\''), +(5049, 0, 8, 10, 62, 0, 100, 0, 9832, 9, 0, 0, 11, 58224, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Lyesa Steelbrow - On Gossip Option 9 Selected - Cast \'Create Tabard of the Explorer\''), +(5049, 0, 9, 10, 62, 0, 100, 0, 9832, 10, 0, 0, 11, 55006, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Lyesa Steelbrow - On Gossip Option 10 Selected - Cast \'Create Tabard of the Achiever\''), +(5191, 0, 10, 0, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Shalumon - On Gossip Option 10 Selected - Close Gossip'), +(5191, 0, 0, 10, 62, 0, 100, 0, 9832, 1, 0, 0, 11, 54974, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Shalumon - On Gossip Option 1 Selected - Cast \'Create Blood Knight Tabard\''), +(5191, 0, 1, 10, 62, 0, 100, 0, 9832, 2, 0, 0, 11, 54976, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Shalumon - On Gossip Option 2 Selected - Cast \'Create Tabard of the Hand\''), +(5191, 0, 2, 10, 62, 0, 100, 0, 9832, 3, 0, 0, 11, 55008, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Shalumon - On Gossip Option 3 Selected - Cast \'Create Tabard of the Protector\''), +(5191, 0, 3, 10, 62, 0, 100, 0, 9832, 4, 0, 0, 11, 54977, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Shalumon - On Gossip Option 4 Selected - Cast \'Create Green Trophy Tabard of the Illidari\''), +(5191, 0, 4, 10, 62, 0, 100, 0, 9832, 5, 0, 0, 11, 54982, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Shalumon - On Gossip Option 5 Selected - Cast \'Create Purple Trophy Tabard of the Illidari\''), +(5191, 0, 5, 10, 62, 0, 100, 0, 9832, 6, 0, 0, 11, 62768, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Shalumon - On Gossip Option 6 Selected - Cast \'Create Tabard of Summer Skies\''), +(5191, 0, 6, 10, 62, 0, 100, 0, 9832, 7, 0, 0, 11, 62769, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Shalumon - On Gossip Option 7 Selected - Cast \'Create Tabard of Summer Flames\''), +(5191, 0, 7, 10, 62, 0, 100, 0, 9832, 8, 0, 0, 11, 58194, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Shalumon - On Gossip Option 8 Selected - Cast \'Create Loremaster\'s Colors\''), +(5191, 0, 8, 10, 62, 0, 100, 0, 9832, 9, 0, 0, 11, 58224, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Shalumon - On Gossip Option 9 Selected - Cast \'Create Tabard of the Explorer\''), +(5191, 0, 9, 10, 62, 0, 100, 0, 9832, 10, 0, 0, 11, 55006, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Shalumon - On Gossip Option 10 Selected - Cast \'Create Tabard of the Achiever\''); From 32a728b33162d5f2a0f0f4b648e1a25b886544a2 Mon Sep 17 00:00:00 2001 From: Aokromes Date: Sat, 17 Jan 2015 01:55:38 +0100 Subject: [PATCH 20/33] Update and rename 2015_01_16_00_world.sql to 2015_01_16_00_world.sql --- .../{ 2015_01_16_00_world.sql => 2015_01_16_00_world.sql} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename sql/updates/world/{ 2015_01_16_00_world.sql => 2015_01_16_00_world.sql} (98%) diff --git a/sql/updates/world/ 2015_01_16_00_world.sql b/sql/updates/world/2015_01_16_00_world.sql similarity index 98% rename from sql/updates/world/ 2015_01_16_00_world.sql rename to sql/updates/world/2015_01_16_00_world.sql index 9c3642d4d8..3488d508a2 100644 --- a/sql/updates/world/ 2015_01_16_00_world.sql +++ b/sql/updates/world/2015_01_16_00_world.sql @@ -1,7 +1,7 @@ -UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry` IN(16766,16610,5188,5189,5190,5191,5049); -UPDATE `creature_template` SET `gossip_menu_id`=9832 WHERE `entry`= IN(5188,5049,5191); +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry` IN (16766,16610,5188,5189,5190,5191,5049); +UPDATE `creature_template` SET `gossip_menu_id`=9832 WHERE `entry` IN (5188,5049,5191); -DELETE FROM `smart_scripts` WHERE `entryorguid` IN(16766,16610,5188,5189,5190,5191,5049); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (16766,16610,5188,5189,5190,5191,5049); INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES (16766, 0, 10, 0, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Issca - On Gossip Option 10 Selected - Close Gossip'), From 4a6d169e4f4b800d51f12ec282ed4c33b1d14093 Mon Sep 17 00:00:00 2001 From: Dr-J Date: Sat, 17 Jan 2015 16:39:33 +0000 Subject: [PATCH 21/33] DB/Misc: Lights Vengeance (Again) Since I scripted this a second sniff surfaced with more data on units which where missing from original sniff --- sql/updates/world/2015_01_17_00_world.sql | 109 ++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 sql/updates/world/2015_01_17_00_world.sql diff --git a/sql/updates/world/2015_01_17_00_world.sql b/sql/updates/world/2015_01_17_00_world.sql new file mode 100644 index 0000000000..0509dba10f --- /dev/null +++ b/sql/updates/world/2015_01_17_00_world.sql @@ -0,0 +1,109 @@ +SET @CGUID := 143410; +DELETE FROM `creature` WHERE `id`IN(37827,37878); +INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `MovementType`) VALUES +(@CGUID+0, 37878, 571, 1, 1, 4785.788, -587.8594, 161.2263, 5.009095, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+1, 37878, 571, 1, 1, 4779.228, -587.1545, 162.1223, 4.537856, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+2, 37878, 571, 1, 1, 4802.324, -553.8646, 163.156, 4.869469, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+3, 37878, 571, 1, 1, 4778.958, -567.7934, 162.0411, 3.647738, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+4, 37878, 571, 1, 1, 4782.333, -572.7118, 161.8683, 5.585053, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+5, 37878, 571, 1, 1, 4789.622, -579.4358, 161.0213, 4.520403, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+6, 37878, 571, 1, 1, 4798.444, -562.9028, 161.4739, 1.466077, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+7, 37878, 571, 1, 1, 4760.652, -561.3246, 165.0569, 3.944444, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+8, 37878, 571, 1, 1, 4787.11, -566.2014, 161.6813, 0, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+9, 37878, 571, 1, 1, 4767.754, -560.6215, 163.8418, 1.064651, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+10, 37878, 571, 1, 1, 4772.837, -575.5347, 162.7558, 1.64061, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+11, 37878, 571, 1, 1, 4797.168, -577.1268, 160.2595, 2.478368, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+12, 37878, 571, 1, 1, 4763.54, -576.6424, 163.8399, 5.253441, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+13, 37878, 571, 1, 1, 4763.713, -569.2257, 163.7682, 3.839724, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+14, 37878, 571, 1, 1, 4800.604, -547.7327, 164.9199, 0.715585, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+15, 37878, 571, 1, 1, 4782.397, -593.6545, 161.6707, 1.605703, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+16, 37878, 571, 1, 1, 4771.824, -566.1719, 162.4859, 0, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+17, 37878, 571, 1, 1, 4791.537, -557.3125, 162.7901, 4.066617, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+18, 37878, 571, 1, 1, 4756.674, -580.4653, 165.0974, 1.48353, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+19, 37878, 571, 1, 1, 4782.095, -580.7483, 161.8616, 1.27409, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+20, 37878, 571, 1, 1, 4772.525, -585.9844, 163.0426, 2.687807, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+21, 37878, 571, 1, 1, 4759.741, -587.8351, 164.6121, 0, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+22, 37878, 571, 1, 1, 4776.268, -596.5695, 162.6325, 2.059489, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+23, 37878, 571, 1, 1, 4793.397, -570.8108, 160.8941, 3.682645, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+24, 37878, 571, 1, 1, 4767.424, -594.3489, 163.828, 1.58825, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+25, 37878, 571, 1, 1, 4797.148, -583.2952, 159.8615, 3.595378, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+26, 37878, 571, 1, 1, 4817.919, -551.9774, 162.0828, 3.036873, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+27, 37878, 571, 1, 1, 4792.533, -591.684, 160.2542, 4.206244, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+28, 37878, 571, 1, 1, 4790.34, -607.0833, 160.2565, 3.525565, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+29, 37878, 571, 1, 1, 4782.63, -605.3073, 161.6125, 0, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+30, 37878, 571, 1, 1, 4817.919, -551.9774, 162.0828, 3.036873, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+31, 37878, 571, 1, 1, 4792.533, -591.684, 160.2542, 4.206244, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+32, 37878, 571, 1, 1, 4790.34, -607.0833, 160.2565, 3.525565, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+33, 37878, 571, 1, 1, 4782.63, -605.3073, 161.6125, 0, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+34, 37878, 571, 1, 1, 4798.115, -607.4479, 159.7254, 0.715585, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+35, 37878, 571, 1, 1, 4791.471, -618.4844, 159.7092, 2.059489, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+36, 37878, 571, 1, 1, 4792.949, -603.3854, 160.3281, 2.740167, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+37, 37878, 571, 1, 1, 4798.659, -602.0208, 159.8221, 2.565634, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+38, 37878, 571, 1, 1, 4810.37, -549.7691, 163.2147, 3.385939, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+39, 37878, 571, 1, 1, 4796.788, -613.9011, 159.7589, 0.8901179, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+40, 37878, 571, 1, 1, 4802.318, -570.2361, 160.2752, 1.064651, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+41, 37878, 571, 1, 1, 4784.508, -609.382, 161.722, 0, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+42, 37878, 571, 1, 1, 4789.024, -611.7726, 160.3697, 0, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+43, 37878, 571, 1, 1, 4816.295, -556.5955, 161.8312, 3.822271, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+44, 37878, 571, 1, 1, 4806.933, -604.0538, 159.585, 0, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+45, 37878, 571, 1, 1, 4809.641, -555.4688, 162.6923, 0.715585, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+46, 37878, 571, 1, 1, 4826.658, -555.1059, 161.3158, 4.625123, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+47, 37878, 571, 1, 1, 4790.142, -624.1771, 159.6133, 0.9773844, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+48, 37878, 571, 1, 1, 4810.255, -627.4636, 159.1524, 1.500983, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+49, 37878, 571, 1, 1, 4810.049, -609.3768, 159.4645, 0, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+50, 37878, 571, 1, 1, 4806.465, -618.2396, 159.5483, 5.445427, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+51, 37878, 571, 1, 1, 4815.847, -606.0087, 160.2059, 0, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+52, 37878, 571, 1, 1, 4793.201, -627.0521, 159.9451, 3.473205, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+53, 37878, 571, 1, 1, 4814.297, -619.2708, 158.7552, 0.715585, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+54, 37878, 571, 1, 1, 4837.163, -576.5104, 160.5024, 5.078908, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+55, 37878, 571, 1, 1, 4800.022, -618.3073, 159.7944, 3.508112, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+56, 37878, 571, 1, 1, 4796.73, -622.5868, 159.9098, 2.356194, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+57, 37878, 571, 1, 1, 4806.011, -623.4809, 159.5464, 2.740167, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+58, 37878, 571, 1, 1, 4803.761, -610.7188, 159.545, 4.24115, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+59, 37878, 571, 1, 1, 4791.314, -635.191, 160.8559, 4.817109, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+60, 37878, 571, 1, 1, 4795.549, -631.2952, 160.2526, 1.361357, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+61, 37878, 571, 1, 1, 4809.817, -614.8125, 159.2753, 2.199115, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+62, 37878, 571, 1, 1, 4828.341, -562.2778, 160.3308, 0.9599311, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+63, 37878, 571, 1, 1, 4793.918, -639.1545, 161.241, 4.468043, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+64, 37878, 571, 1, 1, 4788.442, -639.3229, 162.3155, 1.37881, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+65, 37878, 571, 1, 1, 4801.533, -631.1614, 160.0972, 3.525565, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+66, 37878, 571, 1, 1, 4804.434, -635.9236, 159.8547, 0, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+67, 37878, 571, 1, 1, 4806.627, -631.4097, 159.5468, 4.939282, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+68, 37878, 571, 1, 1, 4835.668, -563.5555, 161.4551, 0.4886922, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+69, 37878, 571, 1, 1, 4788.494, -629.8542, 161.1564, 5.340707, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+70, 37878, 571, 1, 1, 4798.058, -635.0156, 160.5321, 3.141593, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+71, 37878, 571, 1, 1, 4814.169, -631.3663, 158.7541, 5.235988, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+72, 37878, 571, 1, 1, 4809.902, -635.441, 159.2038, 1.151917, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+73, 37878, 571, 1, 1, 4845.159, -576.0278, 159.9401, 5.532694, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+74, 37878, 571, 1, 1, 4845.673, -593.6736, 159.1436, 3.874631, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+75, 37878, 571, 1, 1, 4809.697, -642.8246, 159.2958, 2.007129, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+76, 37878, 571, 1, 1, 4804.116, -640.8143, 160.1202, 2.373648, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+77, 37878, 571, 1, 1, 4825.955, -637.9774, 157.6442, 5.340707, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+78, 37878, 571, 1, 1, 4854.851, -593.2795, 157.3008, 4.625123, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+79, 37878, 571, 1, 1, 4822.641, -641.3472, 157.8503, 3.944444, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+80, 37878, 571, 1, 1, 4843.747, -587.0625, 159.7272, 0.9250245, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+81, 37878, 571, 1, 1, 4822.299, -616.1996, 157.9486, 2.286381, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+82, 37878, 571, 1, 1, 4851.638, -585.6007, 158.117, 2.059489, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+83, 37878, 571, 1, 1, 4842.857, -580.882, 159.7307, 2.96706, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+84, 37878, 571, 1, 1, 4826.226, -624.4792, 157.9513, 0, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+85, 37878, 571, 1, 1, 4845.403, -613.0851, 157.4199, 1.815142, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+86, 37878, 571, 1, 1, 4840.92, -570.6979, 161.174, 3.769911, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+87, 37878, 571, 1, 1, 4837.809, -627.6736, 157.6199, 1.954769, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+88, 37878, 571, 1, 1, 4813.187, -639.132, 158.8725, 0, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+89, 37878, 571, 1, 1, 4833.483, -635.0799, 157.4865, 4.834562, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+90, 37878, 571, 1, 1, 4842.37, -621.6962, 157.5227, 2.879793, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+91, 37878, 571, 1, 1, 4829.419, -629.3629, 157.6456, 3.612832, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+92, 37878, 571, 1, 1, 4815.688, -625.3021, 158.6156, 4.066617, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+93, 37878, 571, 1, 1, 4848.793, -601.8837, 157.445, 4.258604, 120, 0, 0), -- 37878 (Area: 4192) +(@CGUID+94, 37827, 571, 1, 1, 4812.731, -582.6302, 162.4707, 4.118977, 120, 0, 0); -- 37827 (Area: 4192) + +UPDATE `smart_scripts` SET `action_param1`=1000 WHERE `entryorguid`=3795201 AND `source_type`=9 AND `id`=6; +UPDATE `smart_scripts` SET `event_param1`=3000, `event_param2`=3000 WHERE `entryorguid`=3785700 AND `source_type`=9 AND `id`=11 AND `link`=0; + +UPDATE `smart_scripts` SET `event_param1`=0, `event_param2`=0, `action_param1`=1000 WHERE `entryorguid`=3785700 AND `source_type`=9 AND `id`=13 AND `link`=0; +UPDATE `smart_scripts` SET `event_param1`=1000, `event_param2`=1000 WHERE `entryorguid`=3785700 AND `source_type`=9 AND `id`=11 AND `link`=0; + +DELETE FROM `smart_scripts` WHERE `entryorguid` =37826 AND `source_type`=0; +INSERT INTO `smart_scripts`(`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(37826,0,0,1,11,0,100,0,0,0,0,0,12,37952,8,0,0,0,0,1,0,0,0,0,0,0,0,"Light's Vengeance - On Spawn - Spawn Light's Vengeance Vehicle Bunny 2"), +(37826,0,1,0,61,0,100,0,0,0,0,0,11,46598,0,0,0,0,0,19,37952,0,0,0,0,0,0,"Light's Vengeance - On Spawn - Cast Ride Vehicle Hardcoded"); From 64a4b12aa670063aa824f683ab0e996839b4123a Mon Sep 17 00:00:00 2001 From: Dr-J Date: Sat, 17 Jan 2015 16:43:00 +0000 Subject: [PATCH 22/33] Rename sql/updates/world/2015_01_17_00_world.sql to 2015_01_17_00_world.sql --- .../world/2015_01_17_00_world.sql => 2015_01_17_00_world.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sql/updates/world/2015_01_17_00_world.sql => 2015_01_17_00_world.sql (100%) diff --git a/sql/updates/world/2015_01_17_00_world.sql b/2015_01_17_00_world.sql similarity index 100% rename from sql/updates/world/2015_01_17_00_world.sql rename to 2015_01_17_00_world.sql From 542f29bfb41f7ad8a31b53ce8063ccf0c4fede19 Mon Sep 17 00:00:00 2001 From: Aokromes Date: Sat, 17 Jan 2015 18:06:51 +0100 Subject: [PATCH 23/33] Rename 2015_01_17_00_world.sql to sql/updates/world/2015_01_17_00_world.sql --- .../updates/world/2015_01_17_00_world.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename 2015_01_17_00_world.sql => sql/updates/world/2015_01_17_00_world.sql (100%) diff --git a/2015_01_17_00_world.sql b/sql/updates/world/2015_01_17_00_world.sql similarity index 100% rename from 2015_01_17_00_world.sql rename to sql/updates/world/2015_01_17_00_world.sql From 48fa7fa992c02d7c17c39c08cb78c6457d034f49 Mon Sep 17 00:00:00 2001 From: click Date: Sun, 18 Jan 2015 02:07:25 +0100 Subject: [PATCH 24/33] Core: Make core build without PCH enabled. --- src/server/game/Conditions/ConditionMgr.h | 1 + src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 6947b7bf17..4ca27f0d98 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -23,6 +23,7 @@ #include "Errors.h" #include #include +#include class Player; class Unit; diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp index c4994a04db..b849b095ce 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp @@ -16,6 +16,7 @@ * with this program. If not, see . */ +#include "GameEventMgr.h" #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "nexus.h" From 866eff64aa90974e2b1a774b8fd6ea4856346635 Mon Sep 17 00:00:00 2001 From: Nyeriah Date: Sun, 18 Jan 2015 20:56:05 -0200 Subject: [PATCH 25/33] Scripts/HellfireRamparts: Add a missing reset call and correct spawn masks for Reinforced Fel Iron Chests Thanks to @ariel- for noticing the missing _Reset(); Closes #13747 --- sql/updates/world/2015_01_18_00_world.sql | 3 +++ .../HellfireRamparts/boss_vazruden_the_herald.cpp | 1 + 2 files changed, 4 insertions(+) create mode 100644 sql/updates/world/2015_01_18_00_world.sql diff --git a/sql/updates/world/2015_01_18_00_world.sql b/sql/updates/world/2015_01_18_00_world.sql new file mode 100644 index 0000000000..0a9e3e38aa --- /dev/null +++ b/sql/updates/world/2015_01_18_00_world.sql @@ -0,0 +1,3 @@ +-- +UPDATE `gameobject` SET `spawnMask` = 1 WHERE `guid` = 20496 AND `id` = 185168; +UPDATE `gameobject` SET `spawnMask` = 2 WHERE `guid` = 20499 AND `id` = 185169; diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index 3951b0eadf..a6c00c05dc 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -86,6 +86,7 @@ class boss_nazan : public CreatureScript void Reset() override { Initialize(); + _Reset(); } void EnterCombat(Unit* /*who*/) override { } From 9bd7b0e5714475d05d74c15bad500e0a59768edd Mon Sep 17 00:00:00 2001 From: Nyeriah Date: Sun, 18 Jan 2015 23:05:18 -0200 Subject: [PATCH 26/33] Scripts/SunwellPlateau: Correct a summon group entry and misc clean up --- .../scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index b6e8c48058..ea56494f0f 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -247,14 +247,11 @@ public: DoCastAOE(SPELL_DARKNESS); } else - { - DarkFiend = false; me->SummonCreatureGroup(CREATURE_GROUP_DARKFIENDS); - } events.ScheduleEvent(EVENT_DARKNESS, DarkFiend ? 3000 : 42000, 0, PHASE_ONE); break; case EVENT_SUMMON_HUMANOIDS: - me->SummonCreatureGroup(CREATURE_GROUP_DARKFIENDS); + me->SummonCreatureGroup(CREATURE_GROUP_HUMANOIDS); events.ScheduleEvent(EVENT_SUMMON_HUMANOIDS, 60000, 0, PHASE_ONE); break; case EVENT_SUMMON_SENTINEL: From afb83faa817d42a6ef5093a9583b68db3d8dfd7f Mon Sep 17 00:00:00 2001 From: Aokromes Date: Thu, 22 Jan 2015 11:08:17 +0100 Subject: [PATCH 27/33] DB/Spells: Fix one startup error --- sql/updates/world/2015_01_21_00_world.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 sql/updates/world/2015_01_21_00_world.sql diff --git a/sql/updates/world/2015_01_21_00_world.sql b/sql/updates/world/2015_01_21_00_world.sql new file mode 100644 index 0000000000..2a63274ce1 --- /dev/null +++ b/sql/updates/world/2015_01_21_00_world.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `spell_script_names` WHERE `spell_id`=70903 AND `ScriptName`='spell_cultist_dark_martyrdrom'; +DELETE FROM `spell_script_names` WHERE `spell_id`=71236 AND `ScriptName`='spell_cultist_dark_martyrdrom'; +UPDATE `spell_script_names` SET `ScriptName`='spell_cultist_dark_martyrdom' WHERE `spell_id` IN (72495,72496,72497,72498,72499,72500); From 2492eddcf2aec3e083d8b014d6d26031a852991b Mon Sep 17 00:00:00 2001 From: Dr-J Date: Thu, 22 Jan 2015 11:48:06 +0000 Subject: [PATCH 28/33] DB/Misc: Fix startup error Add a missing NPC text which was causing startup error --- sql/updates/world/2015_01_22_00_world.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 sql/updates/world/2015_01_22_00_world.sql diff --git a/sql/updates/world/2015_01_22_00_world.sql b/sql/updates/world/2015_01_22_00_world.sql new file mode 100644 index 0000000000..6392ea2abe --- /dev/null +++ b/sql/updates/world/2015_01_22_00_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `npc_text` WHERE `ID`=9690; +INSERT INTO `npc_text` (`ID`, `text0_0`, `text0_1`, `BroadcastTextID0`, `lang0`, `prob0`, `em0_0`, `em0_1`, `em0_2`, `em0_3`, `em0_4`, `em0_5`, `text1_0`, `text1_1`, `BroadcastTextID1`, `lang1`, `prob1`, `em1_0`, `em1_1`, `em1_2`, `em1_3`, `em1_4`, `em1_5`, `text2_0`, `text2_1`, `BroadcastTextID2`, `lang2`, `prob2`, `em2_0`, `em2_1`, `em2_2`, `em2_3`, `em2_4`, `em2_5`, `text3_0`, `text3_1`, `BroadcastTextID3`, `lang3`, `prob3`, `em3_0`, `em3_1`, `em3_2`, `em3_3`, `em3_4`, `em3_5`, `text4_0`, `text4_1`, `BroadcastTextID4`, `lang4`, `prob4`, `em4_0`, `em4_1`, `em4_2`, `em4_3`, `em4_4`, `em4_5`, `text5_0`, `text5_1`, `BroadcastTextID5`, `lang5`, `prob5`, `em5_0`, `em5_1`, `em5_2`, `em5_3`, `em5_4`, `em5_5`, `text6_0`, `text6_1`, `BroadcastTextID6`, `lang6`, `prob6`, `em6_0`, `em6_1`, `em6_2`, `em6_3`, `em6_4`, `em6_5`, `text7_0`, `text7_1`, `BroadcastTextID7`, `lang7`, `prob7`, `em7_0`, `em7_1`, `em7_2`, `em7_3`, `em7_4`, `em7_5`, `VerifiedBuild`) VALUES +(9690, 'The younger races make a big fuss over Winter Veil. Ironforge''s bank is the center of the festivities.', 'The younger races make a big fuss over Winter Veil. Ironforge''s bank is the center of the festivities.', 16179, 0, 01, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); From 117dd5d8fa9f1ab76f2abd00d2befc2e698815c6 Mon Sep 17 00:00:00 2001 From: Dr-J Date: Sun, 25 Jan 2015 02:09:17 +0000 Subject: [PATCH 29/33] DB/Quest: Adding Injury to Insult Fix http://www.wowhead.com/quest=12481/adding-injury-to-insult so it works as on retail * Bjorn Halgurdsson unattackable until the Vrykul Insult is used on him, by setting passive + flags 2 unattackable since unlike using immune to pc this still allows the insult to be cast without getting invalid target * It is now possible to get Bjorn Halgurdsson to Lydias Ambush without him evading as previously you could only get him as far as the water * ensuring this resets correctly in event of evade. --- sql/updates/world/2015_01_25_00_world.sql | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 sql/updates/world/2015_01_25_00_world.sql diff --git a/sql/updates/world/2015_01_25_00_world.sql b/sql/updates/world/2015_01_25_00_world.sql new file mode 100644 index 0000000000..d089fff4cc --- /dev/null +++ b/sql/updates/world/2015_01_25_00_world.sql @@ -0,0 +1,29 @@ +UPDATE `smart_scripts` SET `link`=18 WHERE `entryorguid`=24238 AND `source_type`=0 AND `id`=16 AND `link`=0; +UPDATE `smart_scripts` SET `link`=22 WHERE `entryorguid`=24238 AND `source_type`=0 AND `id`=13 AND `link`=0; +UPDATE `smart_scripts` SET `link`=24 WHERE `entryorguid`=24238 AND `source_type`=0 AND `id`=2 AND `link`=0; + +DELETE FROM `smart_scripts` WHERE `entryorguid`=24238 AND `source_type`=0 AND `id`>16; +DELETE FROM `smart_scripts` WHERE `entryorguid`=24474 AND `source_type`=0 AND `id`>1; +DELETE FROM `smart_scripts` WHERE `entryorguid`=24458 AND `source_type`=0 AND `id`>2; + +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(24238, 0, 17, 0, 0, 0, 100, 0, 1000, 1000, 1000, 1000, 101, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Bjorn Halgurdsson - IC - Update Home Position'), +(24238, 0, 18, 27, 61, 0, 100, 0, 0, 0, 0, 0, 53, 1, 24238, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Bjorn Halgurdsson - On Evade - Start WP'), +(24238, 0, 19, 20, 34, 0, 100, 0, 0, 1, 0, 0, 66, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 5.41052, 'Bjorn Halgurdsson - On Reached WP1 - Set Orientation'), +(24238, 0, 20, 21, 61, 0, 100, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Bjorn Halgurdsson - Reached WP1 - Set Home Position'), +(24238, 0, 21, 0, 61, 0, 100, 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Bjorn Halgurdsson - Reached WP1 - Reset Script'), +(24238, 0, 22, 23, 61, 0, 100, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Bjorn Halgurdsson - On Spawn - Set Passive'), +(24238, 0, 23, 0, 61, 0, 100, 0, 0, 0, 0, 0, 18, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Bjorn Halgurdsson - On Spawn - Set Non Attackable'), +(24238, 0, 24, 25, 61, 0, 100, 0, 0, 0, 0, 0, 8, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Bjorn Halgurdsson - On Spellhit "Vrykul Insult" - Set Hostile'), +(24238, 0, 25, 26, 61, 0, 100, 0, 0, 0, 0, 0, 19, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Bjorn Halgurdsson - On Spellhit "Vrykul Insult" - Set Attackable'), +(24238, 0, 26, 0, 61, 0, 100, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Bjorn Halgurdsson - On Spellhit "Vrykul Insult" - Attack Invoker'), +(24238, 0, 27, 28, 61, 0, 100, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Bjorn Halgurdsson - On Evade - Set Passive'), +(24238, 0, 28, 0, 61, 0, 100, 0, 0, 0, 0, 0, 18, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Bjorn Halgurdsson - On Evade - Set Non Attackable'), +(24474, 0, 2, 3, 4, 0, 100, 0, 0, 0, 0, 0, 64, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Vengeance Landing Assassin - On Agro - Store Targetlist'), +(24474, 0, 3, 4, 61, 0, 100, 0, 0, 0, 0, 0, 100, 1, 0, 0, 0, 0, 0, 19, 24458, 0, 0, 0, 0, 0, 0, 'Vengeance Landing Assassin - On Agro - Send Targetlist to Lydia'), +(24474, 0, 4, 0, 61, 0, 100, 0, 0, 0, 0, 0, 45, 1, 1, 0, 0, 0, 0, 19, 24458, 0, 0, 0, 0, 0, 0, 'Vengeance Landing Assassin - On Agro - Set Data 1 1 on Lydia'), +(24458, 0, 3, 0, 38, 0, 100, 0, 1, 1, 0, 0, 49, 0, 0, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 'Lydell - On Data Set - Attack Stored Target'); + +DELETE FROM `waypoints` WHERE `entry`=24238; +INSERT INTO `waypoints` (`entry`, `pointid`, `position_x`, `position_y`, `position_z`, `point_comment`) VALUES +(24238, 1, 1518.61, -5249.85, 207.396, 'Bjorn Halgurdsson'); From 48f6e341d5e49a3d9cd3fb4cd43a85ed262b350a Mon Sep 17 00:00:00 2001 From: Nayd Date: Sun, 25 Jan 2015 15:22:33 +0000 Subject: [PATCH 30/33] Tools: Remove mesh_extractor mesh_extractor is not ready for production and it will be developed in a different branch (cherry picked from commit a87442be68da4e2ea51a10e3bd8a07ef7b9765b2) Conflicts: src/tools/mesh_extractor/ContinentBuilder.h src/tools/mesh_extractor/DBC.cpp --- cmake/options.cmake | 1 - src/tools/CMakeLists.txt | 2 - src/tools/mesh_extractor/ADT.cpp | 70 --- src/tools/mesh_extractor/ADT.h | 49 -- src/tools/mesh_extractor/CMakeLists.txt | 50 -- src/tools/mesh_extractor/Cache.h | 80 --- src/tools/mesh_extractor/Chunk.cpp | 48 -- src/tools/mesh_extractor/Chunk.h | 37 -- src/tools/mesh_extractor/ChunkedData.cpp | 91 --- src/tools/mesh_extractor/ChunkedData.h | 38 -- src/tools/mesh_extractor/Constants.h | 75 --- src/tools/mesh_extractor/ContinentBuilder.cpp | 213 ------- src/tools/mesh_extractor/ContinentBuilder.h | 47 -- src/tools/mesh_extractor/DBC.cpp | 87 --- src/tools/mesh_extractor/DBC.h | 70 --- src/tools/mesh_extractor/DoodadHandler.cpp | 126 ---- src/tools/mesh_extractor/DoodadHandler.h | 79 --- src/tools/mesh_extractor/Geometry.cpp | 146 ----- src/tools/mesh_extractor/Geometry.h | 40 -- src/tools/mesh_extractor/LiquidHandler.cpp | 119 ---- src/tools/mesh_extractor/LiquidHandler.h | 38 -- src/tools/mesh_extractor/MPQ.cpp | 139 ----- src/tools/mesh_extractor/MPQ.h | 106 ---- src/tools/mesh_extractor/MPQManager.cpp | 132 ---- src/tools/mesh_extractor/MPQManager.h | 53 -- src/tools/mesh_extractor/MapChunk.cpp | 93 --- src/tools/mesh_extractor/MapChunk.h | 41 -- src/tools/mesh_extractor/MeshExtractor.cpp | 486 --------------- src/tools/mesh_extractor/Model.cpp | 84 --- src/tools/mesh_extractor/Model.h | 40 -- .../mesh_extractor/ObjectDataHandler.cpp | 26 - src/tools/mesh_extractor/ObjectDataHandler.h | 32 - src/tools/mesh_extractor/TileBuilder.cpp | 414 ------------- src/tools/mesh_extractor/TileBuilder.h | 51 -- src/tools/mesh_extractor/Utils.cpp | 564 ------------------ src/tools/mesh_extractor/Utils.h | 407 ------------- src/tools/mesh_extractor/WDT.cpp | 78 --- src/tools/mesh_extractor/WDT.h | 46 -- src/tools/mesh_extractor/WorldModelGroup.cpp | 160 ----- src/tools/mesh_extractor/WorldModelGroup.h | 55 -- .../mesh_extractor/WorldModelHandler.cpp | 237 -------- src/tools/mesh_extractor/WorldModelHandler.h | 64 -- src/tools/mesh_extractor/WorldModelRoot.cpp | 96 --- src/tools/mesh_extractor/WorldModelRoot.h | 44 -- src/tools/mesh_extractor/readme | 6 - 45 files changed, 4960 deletions(-) delete mode 100644 src/tools/mesh_extractor/ADT.cpp delete mode 100644 src/tools/mesh_extractor/ADT.h delete mode 100644 src/tools/mesh_extractor/CMakeLists.txt delete mode 100644 src/tools/mesh_extractor/Cache.h delete mode 100644 src/tools/mesh_extractor/Chunk.cpp delete mode 100644 src/tools/mesh_extractor/Chunk.h delete mode 100644 src/tools/mesh_extractor/ChunkedData.cpp delete mode 100644 src/tools/mesh_extractor/ChunkedData.h delete mode 100644 src/tools/mesh_extractor/Constants.h delete mode 100644 src/tools/mesh_extractor/ContinentBuilder.cpp delete mode 100644 src/tools/mesh_extractor/ContinentBuilder.h delete mode 100644 src/tools/mesh_extractor/DBC.cpp delete mode 100644 src/tools/mesh_extractor/DBC.h delete mode 100644 src/tools/mesh_extractor/DoodadHandler.cpp delete mode 100644 src/tools/mesh_extractor/DoodadHandler.h delete mode 100644 src/tools/mesh_extractor/Geometry.cpp delete mode 100644 src/tools/mesh_extractor/Geometry.h delete mode 100644 src/tools/mesh_extractor/LiquidHandler.cpp delete mode 100644 src/tools/mesh_extractor/LiquidHandler.h delete mode 100644 src/tools/mesh_extractor/MPQ.cpp delete mode 100644 src/tools/mesh_extractor/MPQ.h delete mode 100644 src/tools/mesh_extractor/MPQManager.cpp delete mode 100644 src/tools/mesh_extractor/MPQManager.h delete mode 100644 src/tools/mesh_extractor/MapChunk.cpp delete mode 100644 src/tools/mesh_extractor/MapChunk.h delete mode 100644 src/tools/mesh_extractor/MeshExtractor.cpp delete mode 100644 src/tools/mesh_extractor/Model.cpp delete mode 100644 src/tools/mesh_extractor/Model.h delete mode 100644 src/tools/mesh_extractor/ObjectDataHandler.cpp delete mode 100644 src/tools/mesh_extractor/ObjectDataHandler.h delete mode 100644 src/tools/mesh_extractor/TileBuilder.cpp delete mode 100644 src/tools/mesh_extractor/TileBuilder.h delete mode 100644 src/tools/mesh_extractor/Utils.cpp delete mode 100644 src/tools/mesh_extractor/Utils.h delete mode 100644 src/tools/mesh_extractor/WDT.cpp delete mode 100644 src/tools/mesh_extractor/WDT.h delete mode 100644 src/tools/mesh_extractor/WorldModelGroup.cpp delete mode 100644 src/tools/mesh_extractor/WorldModelGroup.h delete mode 100644 src/tools/mesh_extractor/WorldModelHandler.cpp delete mode 100644 src/tools/mesh_extractor/WorldModelHandler.h delete mode 100644 src/tools/mesh_extractor/WorldModelRoot.cpp delete mode 100644 src/tools/mesh_extractor/WorldModelRoot.h delete mode 100644 src/tools/mesh_extractor/readme diff --git a/cmake/options.cmake b/cmake/options.cmake index 49a9e5551d..83783fdc1b 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -15,5 +15,4 @@ option(USE_SCRIPTPCH "Use precompiled headers when compiling scripts" option(USE_COREPCH "Use precompiled headers when compiling servers" 1) option(WITH_WARNINGS "Show all warnings during compile" 0) option(WITH_COREDEBUG "Include additional debug-code in core" 0) -option(WITH_MESHEXTRACTOR "Build meshextractor (alpha)" 0) option(WITHOUT_GIT "Disable the GIT testing routines" 0) diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 272c8cd1fb..d806858eea 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -12,6 +12,4 @@ add_subdirectory(map_extractor) add_subdirectory(vmap4_assembler) add_subdirectory(vmap4_extractor) add_subdirectory(mmaps_generator) -if (WITH_MESHEXTRACTOR) - add_subdirectory(mesh_extractor) endif() diff --git a/src/tools/mesh_extractor/ADT.cpp b/src/tools/mesh_extractor/ADT.cpp deleted file mode 100644 index 0165a9000f..0000000000 --- a/src/tools/mesh_extractor/ADT.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "ADT.h" -#include "DoodadHandler.h" -#include "LiquidHandler.h" -#include "WorldModelHandler.h" - -ADT::ADT( std::string file, int x, int y ) : ObjectData(NULL), Data(NULL), HasObjectData(false), - _DoodadHandler(NULL), _WorldModelHandler(NULL), _LiquidHandler(NULL), X(x), Y(y) -{ - Data = new ChunkedData(file); - ObjectData = new ChunkedData(file); - if (ObjectData->Stream) - HasObjectData = true; - else - ObjectData = NULL; -} - -ADT::~ADT() -{ - delete ObjectData; - delete Data; - - for (std::vector::iterator itr = MapChunks.begin(); itr != MapChunks.end(); ++itr) - delete *itr; - - MapChunks.clear(); - delete _DoodadHandler; - delete _WorldModelHandler; - delete _LiquidHandler; -} - -void ADT::Read() -{ - Header.Read(Data->GetChunkByName("MHDR")->GetStream()); - MapChunks.reserve(16 * 16); - - for (std::vector::iterator itr = Data->Chunks.begin(); itr != Data->Chunks.end(); ++itr) - if ((*itr)->Name == "MCNK") - MapChunks.push_back(new MapChunk(this, *itr)); - - _LiquidHandler = new LiquidHandler(this); - - // do this separate from map chunk initialization to access liquid data - for (std::vector::iterator itr = MapChunks.begin(); itr != MapChunks.end(); ++itr) - (*itr)->GenerateTriangles(); - - _DoodadHandler = new DoodadHandler(this); - for (std::vector::iterator itr = MapChunks.begin(); itr != MapChunks.end(); ++itr) - _DoodadHandler->ProcessMapChunk(*itr); - - _WorldModelHandler = new WorldModelHandler(this); - for (std::vector::iterator itr = MapChunks.begin(); itr != MapChunks.end(); ++itr) - _WorldModelHandler->ProcessMapChunk(*itr); -} diff --git a/src/tools/mesh_extractor/ADT.h b/src/tools/mesh_extractor/ADT.h deleted file mode 100644 index 55bd862335..0000000000 --- a/src/tools/mesh_extractor/ADT.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef ADT_H -#define ADT_H -#include "ChunkedData.h" -#include "MapChunk.h" - -class DoodadHandler; -class WorldModelHandler; -class LiquidHandler; - -class ADT -{ -public: - ADT(std::string file, int x, int y); - ~ADT(); - - void Read(); - - ChunkedData* ObjectData; - ChunkedData* Data; - std::vector MapChunks; - MHDR Header; - // Can we dispose of this? - bool HasObjectData; - - DoodadHandler* _DoodadHandler; - WorldModelHandler* _WorldModelHandler; - LiquidHandler* _LiquidHandler; - - int X; - int Y; -}; -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/CMakeLists.txt b/src/tools/mesh_extractor/CMakeLists.txt deleted file mode 100644 index eb3c63504d..0000000000 --- a/src/tools/mesh_extractor/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (C) 2005-2009 MaNGOS project -# Copyright (C) 2008-2015 TrinityCore -# -# This file is free software; as a special exception the author gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -file(GLOB_RECURSE meshExtract_Sources *.cpp *.h) - -set(include_Base - ${CMAKE_BINARY_DIR} - ${CMAKE_SOURCE_DIR}/src/server/shared - ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Recast - ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour - ${CMAKE_SOURCE_DIR}/dep/libmpq - ${CMAKE_SOURCE_DIR}/dep/g3dlite/include - ${ACE_INCLUDE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} -) - -if( WIN32 ) - set(include_Base - ${include_Base} - ${CMAKE_SOURCE_DIR}/dep/libmpq/win - ) -endif() - -include_directories(${include_Base}) - -add_executable(MeshExtractor ${meshExtract_Sources}) - -target_link_libraries(MeshExtractor - g3dlib - mpq - Recast - Detour - ${BZIP2_LIBRARIES} - ${ZLIB_LIBRARIES} - ${ACE_LIBRARY} -) - -if( UNIX ) - install(TARGETS MeshExtractor DESTINATION bin) -elseif( WIN32 ) - install(TARGETS MeshExtractor DESTINATION "${CMAKE_INSTALL_PREFIX}") -endif() diff --git a/src/tools/mesh_extractor/Cache.h b/src/tools/mesh_extractor/Cache.h deleted file mode 100644 index 9cdec6bed2..0000000000 --- a/src/tools/mesh_extractor/Cache.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef CACHE_H -#define CACHE_H -#include -#include -#include "Define.h" -#include -#include -#include "WorldModelRoot.h" -#include "Model.h" - -template -class GenericCache -{ -public: - GenericCache() {} - - static const uint32 FlushLimit = 300; // We can't get too close to filling up all the memory, and we have to be wary of the maximum number of open streams. - - void Insert(K key, T* val) - { - ACE_GUARD(ACE_Thread_Mutex, g, mutex); - - if (_items.size() > FlushLimit) - Clear(); - _items[key] = val; - } - - T* Get(K key) - { - ACE_GUARD_RETURN(ACE_Thread_Mutex, g, mutex, NULL); - typename std::map::iterator itr = _items.find(key); - if (itr != _items.end()) - return itr->second; - return NULL; - } - - void Clear() - { - for (typename std::map::iterator itr = _items.begin(); itr != _items.end(); ++itr) - delete itr->second; - _items.clear(); - } -private: - std::map _items; - ACE_Thread_Mutex mutex; -}; - -class CacheClass -{ -public: - CacheClass() {} - GenericCache ModelCache; - GenericCache WorldModelCache; - - void Clear() - { - ModelCache.Clear(); - WorldModelCache.Clear(); - } -}; - -extern CacheClass* Cache; -#endif diff --git a/src/tools/mesh_extractor/Chunk.cpp b/src/tools/mesh_extractor/Chunk.cpp deleted file mode 100644 index 62dd885e16..0000000000 --- a/src/tools/mesh_extractor/Chunk.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "Chunk.h" -#include "Utils.h" - -int32 Chunk::FindSubChunkOffset(std::string name) -{ - // Reverse the name - name = std::string(name.rbegin(), name.rend()); - if (name.size() != 4) - return -1; - - FILE* stream = GetStream(); - uint32 matched = 0; - while (uint32(ftell(stream)) < Utils::Size(stream)) - { - char b = 0; - if (fread(&b, sizeof(char), 1, stream) != 1 || b != name[matched]) - matched = 0; - else - ++matched; - - if (matched == 4) - return ftell(stream) - 4; - } - return -1; -} - -FILE* Chunk::GetStream() -{ - fseek(Stream, Offset, SEEK_SET); - return Stream; -} diff --git a/src/tools/mesh_extractor/Chunk.h b/src/tools/mesh_extractor/Chunk.h deleted file mode 100644 index 8c8125ce24..0000000000 --- a/src/tools/mesh_extractor/Chunk.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef CHUNK_H -#define CHUNK_H -#include "Define.h" -#include -class ChunkedData; - -class Chunk -{ -public: - Chunk(const char* name, uint32 length, uint32 offset, FILE* stream) : Name(name), Length(length), Offset(offset), Stream(stream) {} - - int32 FindSubChunkOffset(std::string name); - FILE* GetStream(); - std::string Name; - uint32 Length; - uint32 Offset; - FILE* Stream; -}; - -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/ChunkedData.cpp b/src/tools/mesh_extractor/ChunkedData.cpp deleted file mode 100644 index 32a6864e04..0000000000 --- a/src/tools/mesh_extractor/ChunkedData.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "ChunkedData.h" -#include "MPQManager.h" -#include "Utils.h" - -#include - -ChunkedData::ChunkedData( FILE* stream, uint32 maxLength, uint32 chunksHint /*= 300*/ ) : -Stream(stream) -{ - if (!Stream) - return; - Load(maxLength, chunksHint); -} - -ChunkedData::ChunkedData( const std::string& file, uint32 chunksHint /*= 300*/ ) -{ - Stream = MPQHandler->GetFile(file); - if (!Stream) - return; - Load(0, chunksHint); -} - -void ChunkedData::Load( uint32 maxLength, uint32 chunksHint ) -{ - if (!maxLength) - maxLength = Utils::Size(Stream); - Chunks.reserve(chunksHint); - uint32 baseOffset = ftell(Stream); - uint32 calcOffset = 0; - while ((calcOffset + baseOffset) < Utils::Size(Stream) && (calcOffset < maxLength)) - { - char nameBytes[5]; - uint32 read = fread(&nameBytes, sizeof(char), 4, Stream); - nameBytes[read] = '\0'; - std::string name = std::string(nameBytes); - // Utils::Reverse(nameBytes); - name = std::string(name.rbegin(), name.rend()); - uint32 length; - if (fread(&length, sizeof(uint32), 1, Stream) != 1) - continue; - calcOffset += 8; - Chunks.push_back(new Chunk(name.c_str(), length, calcOffset + baseOffset, Stream)); - calcOffset += length; - // save an extra seek at the end - if ((calcOffset + baseOffset) < Utils::Size(Stream) && calcOffset < maxLength) - fseek(Stream, length, SEEK_CUR); - } -} - -int ChunkedData::GetFirstIndex( const std::string& name ) -{ - for (uint32 i = 0; i < Chunks.size(); ++i) - if (Chunks[i]->Name == name) - return i; - return -1; -} - -Chunk* ChunkedData::GetChunkByName( const std::string& name ) -{ - for (uint32 i = 0; i < Chunks.size(); ++i) - if (Chunks[i]->Name == name) - return Chunks[i]; - return NULL; -} - -ChunkedData::~ChunkedData() -{ - for (std::vector::iterator itr = Chunks.begin(); itr != Chunks.end(); ++itr) - delete *itr; - - Chunks.clear(); - if (Stream) - fclose(Stream); -} diff --git a/src/tools/mesh_extractor/ChunkedData.h b/src/tools/mesh_extractor/ChunkedData.h deleted file mode 100644 index c674a2fa87..0000000000 --- a/src/tools/mesh_extractor/ChunkedData.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef CHNK_H -#define CHNK_H - -#include -#include "Chunk.h" - -class ChunkedData -{ -public: - ChunkedData(FILE* stream, uint32 maxLength, uint32 chunksHint = 300); - ChunkedData(const std::string &file, uint32 chunksHint = 300); - ~ChunkedData(); - - int GetFirstIndex(const std::string& name); - Chunk* GetChunkByName(const std::string& name); - - void Load(uint32 maxLength, uint32 chunksHint); - std::vector Chunks; - FILE* Stream; -}; -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/Constants.h b/src/tools/mesh_extractor/Constants.h deleted file mode 100644 index daa8eef2a7..0000000000 --- a/src/tools/mesh_extractor/Constants.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef CONSTANTS_H -#define CONSTANTS_H - -class Constants -{ -public: - enum TriangleType - { - TRIANGLE_TYPE_UNKNOWN, - TRIANGLE_TYPE_TERRAIN, - TRIANGLE_TYPE_WATER, - TRIANGLE_TYPE_DOODAD, - TRIANGLE_TYPE_WMO - }; - - enum PolyArea - { - POLY_AREA_TERRAIN = 1, - POLY_AREA_WATER = 2, - POLY_AREA_ROAD = 3, - POLY_AREA_DANGER = 4, - }; - - enum PolyFlag - { - POLY_FLAG_WALK = 1, - POLY_FLAG_SWIM = 2, - POLY_FLAG_FLIGHTMASTER = 4 - }; - - enum ExtractFlags - { - EXTRACT_FLAG_DBC = 0x01, - EXTRACT_FLAG_MAPS = 0x02, - EXTRACT_FLAG_VMAPS = 0x04, - EXTRACT_FLAG_GOB_MODELS = 0x08, - EXTRACT_FLAG_MMAPS = 0x10, - EXTRACT_FLAG_TEST = 0x20, - EXTRACT_FLAG_ALLOWED = EXTRACT_FLAG_DBC | EXTRACT_FLAG_MAPS | EXTRACT_FLAG_VMAPS | EXTRACT_FLAG_GOB_MODELS | EXTRACT_FLAG_MMAPS | EXTRACT_FLAG_TEST - }; - - static const float TileSize; - static const float MaxXY; - static const float ChunkSize; - static const float UnitSize; - static const float Origin[]; - static const float PI; - static const float MaxStandableHeight; - static bool ToWoWCoords; - static bool Debug; - static const char* VMAPMagic; - static const float BaseUnitDim; - static const int VertexPerMap; - static const int VertexPerTile; - static const int TilesPerMap; -}; - -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/ContinentBuilder.cpp b/src/tools/mesh_extractor/ContinentBuilder.cpp deleted file mode 100644 index a60a4b4ce3..0000000000 --- a/src/tools/mesh_extractor/ContinentBuilder.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "ContinentBuilder.h" -#include "TileBuilder.h" -#include "WDT.h" -#include "Utils.h" -#include "DetourNavMesh.h" -#include "Cache.h" -#include "ace/Task.h" -#include "Recast.h" -#include "DetourCommon.h" - -class BuilderThread : public ACE_Task_Base -{ -private: - int X, Y, MapId; - std::string Continent; - dtNavMeshParams Params; - ContinentBuilder* cBuilder; -public: - BuilderThread(ContinentBuilder* _cBuilder, dtNavMeshParams& params) : Params(params), cBuilder(_cBuilder), Free(true) {} - - void SetData(int x, int y, int map, const std::string& cont) - { - X = x; - Y = y; - MapId = map; - Continent = cont; - } - - int svc() - { - Free = false; - printf("[%02i,%02i] Building tile\n", X, Y); - TileBuilder builder(cBuilder, Continent, X, Y, MapId); - char buff[100]; - sprintf(buff, "mmaps/%03u%02i%02i.mmtile", MapId, Y, X); - FILE* f = fopen(buff, "r"); - if (f) // Check if file already exists. - { - printf("[%02i,%02i] Tile skipped, file already exists\n", X, Y); - fclose(f); - Free = true; - return 0; - } - uint8* nav = builder.BuildTiled(Params); - if (nav) - { - f = fopen(buff, "wb"); - if (!f) - { - printf("Could not create file %s. Check that you have write permissions to the destination folder and try again\n", buff); - return 0; - } - MmapTileHeader header; - header.size = builder.DataSize; - fwrite(&header, sizeof(MmapTileHeader), 1, f); - fwrite(nav, sizeof(unsigned char), builder.DataSize, f); - fclose(f); - } - dtFree(nav); - printf("[%02i,%02i] Tile Built!\n", X, Y); - Free = true; - return 0; - } - - bool Free; -}; - -void ContinentBuilder::getTileBounds(uint32 tileX, uint32 tileY, float* verts, int vertCount, float* bmin, float* bmax) -{ - // this is for elevation - if (verts && vertCount) - rcCalcBounds(verts, vertCount, bmin, bmax); - else - { - bmin[1] = FLT_MIN; - bmax[1] = FLT_MAX; - } - - // this is for width and depth - bmax[0] = (32 - int(tileX)) * Constants::TileSize; - bmax[2] = (32 - int(tileY)) * Constants::TileSize; - bmin[0] = bmax[0] - Constants::TileSize; - bmin[2] = bmax[2] - Constants::TileSize; -} - -void ContinentBuilder::CalculateTileBounds() -{ - for (std::vector::iterator itr = TileMap->TileTable.begin(); itr != TileMap->TileTable.end(); ++itr) - { - tileXMax = std::max(itr->X, tileXMax); - tileXMin = std::min(itr->X, tileXMin); - - tileYMax = std::max(itr->Y, tileYMax); - tileYMin = std::min(itr->Y, tileYMin); - } - getTileBounds(tileXMax, tileYMax, NULL, 0, bmin, bmax); -} - -void ContinentBuilder::Build() -{ - char buff[50]; - sprintf(buff, "mmaps/%03u.mmap", MapId); - FILE* mmap = fopen(buff, "wb"); - if (!mmap) - { - printf("Could not create file %s. Check that you have write permissions to the destination folder and try again\n", buff); - return; - } - - CalculateTileBounds(); - - dtNavMeshParams params; - - std::vector Threads; - - if (TileMap->IsGlobalModel) - { - printf("Map %s ( %u ) is a WMO. Building with 1 thread.\n", Continent.c_str(), MapId); - - TileBuilder* builder = new TileBuilder(this, Continent, 0, 0, MapId); - builder->AddGeometry(TileMap->Model, TileMap->ModelDefinition); - uint8* nav = builder->BuildInstance(params); - if (nav) - { - // Set some params for the navmesh - dtMeshHeader* header = (dtMeshHeader*)nav; - dtVcopy(params.orig, header->bmin); - params.tileWidth = header->bmax[0] - header->bmin[0]; - params.tileHeight = header->bmax[2] - header->bmin[2]; - params.maxTiles = 1; - params.maxPolys = header->polyCount; - fwrite(¶ms, sizeof(dtNavMeshParams), 1, mmap); - fclose(mmap); - - char buff[100]; - sprintf(buff, "mmaps/%03u%02i%02i.mmtile", MapId, 0, 0); - FILE* f = fopen(buff, "wb"); - if (!f) - { - printf("Could not create file %s. Check that you have write permissions to the destination folder and try again\n", buff); - return; - } - - MmapTileHeader mheader; - mheader.size = builder->DataSize; - fwrite(&mheader, sizeof(MmapTileHeader), 1, f); - fwrite(nav, sizeof(unsigned char), builder->DataSize, f); - fclose(f); - } - - dtFree(nav); - delete builder; - } - else - { - params.maxPolys = 32768; - params.maxTiles = 4096; - rcVcopy(params.orig, Constants::Origin); - params.tileHeight = Constants::TileSize; - params.tileWidth = Constants::TileSize; - fwrite(¶ms, sizeof(dtNavMeshParams), 1, mmap); - fclose(mmap); - - for (uint32 i = 0; i < NumberOfThreads; ++i) - Threads.push_back(new BuilderThread(this, params)); - printf("Map %s ( %u ) has %u tiles. Building them with %u threads\n", Continent.c_str(), MapId, uint32(TileMap->TileTable.size()), NumberOfThreads); - for (std::vector::iterator itr = TileMap->TileTable.begin(); itr != TileMap->TileTable.end(); ++itr) - { - bool next = false; - while (!next) - { - for (std::vector::iterator _th = Threads.begin(); _th != Threads.end(); ++_th) - { - if ((*_th)->Free) - { - (*_th)->SetData(itr->X, itr->Y, MapId, Continent); - (*_th)->activate(); - next = true; - break; - } - } - // Wait for 20 seconds - ACE_OS::sleep(ACE_Time_Value (0, 20000)); - } - } - } - - Cache->Clear(); - - // Free memory - for (std::vector::iterator _th = Threads.begin(); _th != Threads.end(); ++_th) - { - (*_th)->wait(); - delete *_th; - } -} diff --git a/src/tools/mesh_extractor/ContinentBuilder.h b/src/tools/mesh_extractor/ContinentBuilder.h deleted file mode 100644 index a2f6512a8d..0000000000 --- a/src/tools/mesh_extractor/ContinentBuilder.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef CONT_BUILDER_H -#define CONT_BUILDER_H -#include -#include "WDT.h" -#include "Define.h" - -class ContinentBuilder -{ -public: - ContinentBuilder(std::string continent, uint32 mapId, WDT* wdt, uint32 tn) : - Continent(continent), TileMap(wdt), MapId(mapId), - NumberOfThreads(tn), tileXMin(64), tileYMin(64), tileXMax(0), tileYMax(0) - {} - - void Build(); - void getTileBounds(uint32 tileX, uint32 tileY, float* verts, int vertCount, float* bmin, float* bmax); - void CalculateTileBounds(); - float bmin[3]; - float bmax[3]; -private: - std::string Continent; - WDT* TileMap; - uint32 MapId; - uint32 NumberOfThreads; - int tileXMin; - int tileYMin; - int tileXMax; - int tileYMax; -}; -#endif diff --git a/src/tools/mesh_extractor/DBC.cpp b/src/tools/mesh_extractor/DBC.cpp deleted file mode 100644 index b87015310c..0000000000 --- a/src/tools/mesh_extractor/DBC.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include -#include "DBC.h" -#include "Define.h" - -DBC::DBC( FILE* stream ) : StringBlock(NULL), StringBlockSize(0), IsFaulty(true) -{ - char magic[5]; - uint32 count = 0; - count += fread(&magic, sizeof(char), 4, stream); - magic[4] = '\0'; - count += fread(&RecordCount, sizeof(uint32), 1, stream); - Records.reserve(RecordCount); - count += fread(&Fields, sizeof(uint32), 1, stream); - count += fread(&RecordSize, sizeof(uint32), 1, stream); - count += fread(&StringBlockSize, sizeof(uint32), 1, stream); - if (count != 8) - printf("DBC::DBC: Failed to read some data expected 8, read %u\n", count); - - for (int i = 0; i < RecordCount; i++) - { - Record* rec = new Record(this); - Records.push_back(rec); - int size = 0; - for (int f = 0; f < Fields; f++) - { - if (size + 4 > RecordSize) - { - IsFaulty = true; - break; - } - uint32 tmp; - if (fread(&tmp, sizeof(uint32), 1, stream) != 1) - printf("DBC::DBC: Failed to read some data expected 1, read 0\n"); - rec->Values.push_back(tmp); - size += 4; - } - } - StringBlock = new uint8[StringBlockSize]; - count = fread(StringBlock, sizeof(uint8), StringBlockSize, stream); - if (count != StringBlockSize) - printf("DBC::DBC: Failed to read some data expected %u, read %u\n", StringBlockSize, count); -} - -std::string DBC::GetStringByOffset( int offset ) -{ - int len = 0; - for (uint32 i = offset; i < StringBlockSize; i++) - { - if (!StringBlock[i]) - { - len = (i - offset); - break; - } - } - char* d = new char[len+1]; - strcpy(d, (const char*)(StringBlock + offset)); - d[len] = '\0'; - std::string val = std::string(d); - delete [] d; - return val; -} - -Record* DBC::GetRecordById( int id ) -{ - // we assume Id is index 0 - for (std::vector::iterator itr = Records.begin(); itr != Records.end(); ++itr) - if ((*itr)->Values[0] == id) - return *itr; - return NULL; -} diff --git a/src/tools/mesh_extractor/DBC.h b/src/tools/mesh_extractor/DBC.h deleted file mode 100644 index df72800c54..0000000000 --- a/src/tools/mesh_extractor/DBC.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef DBC_H -#define DBC_H -#include -#include -#include "Define.h" - -class Record; - -class DBC -{ -public: - DBC(FILE* stream); - - std::string GetStringByOffset(int offset); - - Record* GetRecordById(int id); - - std::string Name; - std::vector Records; - int RecordCount; - int Fields; - int RecordSize; - uint8* StringBlock; - uint32 StringBlockSize; - bool IsFaulty; -}; - -class Record -{ -public: - Record(DBC* dbc) : Source(dbc) {} - - DBC* Source; - std::vector Values; - - int operator[](int index) - { - return Values[index]; - } - - template - T GetValue(int index) - { - return *(T*)(&Values[index]); - } - - std::string GetString(int index) - { - return Source->GetStringByOffset(Values[index]); - } -}; - -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/DoodadHandler.cpp b/src/tools/mesh_extractor/DoodadHandler.cpp deleted file mode 100644 index 72b5ce2fcc..0000000000 --- a/src/tools/mesh_extractor/DoodadHandler.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "DoodadHandler.h" -#include "Chunk.h" -#include "Cache.h" -#include "Model.h" -#include "G3D/Matrix4.h" - -DoodadHandler::DoodadHandler( ADT* adt ) : - ObjectDataHandler(adt), _definitions(NULL), _paths(NULL) -{ - Chunk* mddf = adt->ObjectData->GetChunkByName("MDDF"); - if (mddf) - ReadDoodadDefinitions(mddf); - - Chunk* mmid = adt->ObjectData->GetChunkByName("MMID"); - Chunk* mmdx = adt->ObjectData->GetChunkByName("MMDX"); - if (mmid && mmdx) - ReadDoodadPaths(mmid, mmdx); -} - -void DoodadHandler::ProcessInternal( MapChunk* mcnk ) -{ - if (!IsSane()) - return; - - uint32 refCount = mcnk->Header.DoodadRefs; - FILE* stream = mcnk->Source->GetStream(); - fseek(stream, mcnk->Source->Offset + mcnk->Header.OffsetMCRF, SEEK_SET); - for (uint32 i = 0; i < refCount; i++) - { - int32 index; - int32 count; - if ((count = fread(&index, sizeof(int32), 1, stream)) != 1) - printf("DoodadHandler::ProcessInternal: Failed to read some data expected 1, read %d\n", count); - if (index < 0 || uint32(index) >= _definitions->size()) - continue; - DoodadDefinition doodad = (*_definitions)[index]; - if (_drawn.find(doodad.UniqueId) != _drawn.end()) - continue; - _drawn.insert(doodad.UniqueId); - if (doodad.MmidIndex >= _paths->size()) - continue; - - std::string path = (*_paths)[doodad.MmidIndex]; - Model* model = Cache->ModelCache.Get(path); - if (!model) - { - model = new Model(path); - Cache->ModelCache.Insert(path, model); - } - if (!model->IsCollidable) - continue; - - Vertices.reserve(refCount * model->Vertices.size() * 0.2); - Triangles.reserve(refCount * model->Triangles.size() * 0.2); - - InsertModelGeometry(doodad, model); - } - // Restore the stream position - fseek(stream, mcnk->Source->Offset, SEEK_SET); -} - -void DoodadHandler::ReadDoodadDefinitions( Chunk* chunk ) -{ - int32 count = chunk->Length / 36; - _definitions = new std::vector; - _definitions->reserve(count); - FILE* stream = chunk->GetStream(); - for (int i = 0; i < count; i++) - { - DoodadDefinition def; - def.Read(stream); - _definitions->push_back(def); - } -} - -void DoodadHandler::ReadDoodadPaths( Chunk* id, Chunk* data ) -{ - int paths = id->Length / 4; - _paths = new std::vector(); - _paths->reserve(paths); - for (int i = 0; i < paths; i++) - { - FILE* idStream = id->GetStream(); - fseek(idStream, i * 4, SEEK_CUR); - uint32 offset; - if (fread(&offset, sizeof(uint32), 1, idStream) != 1) - printf("DoodadHandler::ReadDoodadPaths: Failed to read some data expected 1, read 0\n"); - FILE* dataStream = data->GetStream(); - fseek(dataStream, offset + data->Offset, SEEK_SET); - _paths->push_back(Utils::ReadString(dataStream)); - } -} - -void DoodadHandler::InsertModelGeometry(const DoodadDefinition& def, Model* model) -{ - uint32 vertOffset = Vertices.size(); - - for (std::vector::iterator itr = model->Vertices.begin(); itr != model->Vertices.end(); ++itr) - Vertices.push_back(Utils::TransformDoodadVertex(def, *itr)); // Vertices have to be converted based on the information from the DoodadDefinition struct - - for (std::vector >::iterator itr = model->Triangles.begin(); itr != model->Triangles.end(); ++itr) - Triangles.push_back(Triangle(Constants::TRIANGLE_TYPE_DOODAD, itr->V0 + vertOffset, itr->V1 + vertOffset, itr->V2 + vertOffset)); -} - -DoodadHandler::~DoodadHandler() -{ - delete _definitions; - delete _paths; -} diff --git a/src/tools/mesh_extractor/DoodadHandler.h b/src/tools/mesh_extractor/DoodadHandler.h deleted file mode 100644 index f37d5d0f70..0000000000 --- a/src/tools/mesh_extractor/DoodadHandler.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef DOOADHNDL_H -#define DOOADHNDL_H -#include "ObjectDataHandler.h" -#include "Utils.h" -#include "Chunk.h" -#include "Model.h" -#include -#include - -class DoodadDefinition : public IDefinition -{ -public: - uint32 MmidIndex; - uint32 UniqueId; - uint16 DecimalScale; - uint16 Flags; - - virtual float Scale() const { return DecimalScale / 1024.0f; } - - Vector3 FixCoords(Vector3& vec) - { - return Vector3(vec.z, vec.x, vec.y); - } - - void Read(FILE* stream) - { - int count = 0; - - count += fread(&MmidIndex, sizeof(uint32), 1, stream); - count += fread(&UniqueId, sizeof(uint32), 1, stream); - Position = (Vector3::Read(stream)); - Rotation = Vector3::Read(stream); - count += fread(&DecimalScale, sizeof(uint16), 1, stream); - count += fread(&Flags, sizeof(uint16), 1, stream); - if (count != 4) - printf("DoodadDefinition::Read: Failed to read some data expected 4, read %d\n", count); - } -}; - -class DoodadHandler : public ObjectDataHandler -{ -public: - DoodadHandler(ADT* adt); - ~DoodadHandler(); - - std::vector Vertices; - std::vector > Triangles; - bool IsSane() { return _definitions && _paths; } - - -protected: - void ProcessInternal(MapChunk* chunk); - -private: - void ReadDoodadDefinitions(Chunk* chunk); - void ReadDoodadPaths(Chunk* id, Chunk* data); - void InsertModelGeometry(const DoodadDefinition& def, Model* model); - std::set _drawn; - std::vector* _definitions; - std::vector* _paths; -}; -#endif diff --git a/src/tools/mesh_extractor/Geometry.cpp b/src/tools/mesh_extractor/Geometry.cpp deleted file mode 100644 index b037c44e63..0000000000 --- a/src/tools/mesh_extractor/Geometry.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "Geometry.h" -#include "Constants.h" -#include "ADT.h" -#include "WorldModelHandler.h" -#include "DoodadHandler.h" -#include - -Geometry::Geometry() : Transform(false) -{ - Vertices.reserve(10000); - Triangles.reserve(10000); -} - -void Geometry::CalculateBoundingBox( float*& min, float*& max ) -{ - min = new float[3]; - max = new float[3]; - for (int i = 0; i < 3; ++i) - { - max[i] = std::numeric_limits::lowest(); - min[i] = std::numeric_limits::max(); - } - - for (std::vector::iterator itr = Vertices.begin(); itr != Vertices.end(); ++itr) - { - if (itr->x > max[0]) - max[0] = itr->x; - if (itr->x < min[0]) - min[0] = itr->x; - - if (itr->y > max[1]) - max[1] = itr->y; - if (itr->y < min[1]) - min[1] = itr->y; - - if (itr->z > max[2]) - max[2] = itr->z; - if (itr->z < min[2]) - min[2] = itr->z; - } -} - -void Geometry::CalculateMinMaxHeight( float& min, float& max ) -{ - min = std::numeric_limits::max(); - max = std::numeric_limits::lowest(); - - for (std::vector::iterator itr = Vertices.begin(); itr != Vertices.end(); ++itr) - { - if (Transform) - { - if (itr->y < min) - min = itr->y; - if (itr->y > max) - max = itr->y; - } - else - { - if (itr->z < min) - min = itr->z; - if (itr->z > max) - max = itr->z; - } - } -} - -void Geometry::AddData( std::vector& verts, std::vector >& tris ) -{ - uint32 vertOffset = Vertices.size(); - for (std::vector::iterator itr = verts.begin(); itr != verts.end(); ++itr) - Vertices.push_back(Transform ? Utils::ToRecast(*itr) : *itr); - - for (std::vector >::iterator itr = tris.begin(); itr != tris.end(); ++itr) - Triangles.push_back(Triangle(itr->Type, itr->V0 + vertOffset, itr->V1 + vertOffset, itr->V2 + vertOffset)); -} - -void Geometry::GetRawData( float*& verts, int*& tris, uint8*& areas ) -{ - verts = new float[Vertices.size() * 3]; - for (uint32 i = 0; i < Vertices.size(); ++i) - { - Vector3& vert = Vertices[i]; - verts[(i * 3) + 0] = vert.x; - verts[(i * 3) + 1] = vert.y; - verts[(i * 3) + 2] = vert.z; - } - - tris = new int[Triangles.size() * 3]; - for (uint32 i = 0; i < Triangles.size(); ++i) - { - Triangle& tri = Triangles[i]; - tris[(i * 3) + 0] = (int)tri.V0; - tris[(i * 3) + 1] = (int)tri.V1; - tris[(i * 3) + 2] = (int)tri.V2; - } - - areas = new uint8[Triangles.size()]; - for (uint32 i = 0; i < Triangles.size(); i++) - { - switch (Triangles[i].Type) - { - case Constants::TRIANGLE_TYPE_WATER: - areas[i] = Constants::POLY_AREA_WATER; - break; - default: - areas[i] = Constants::POLY_AREA_TERRAIN; - break; - } - } -} - -void Geometry::AddAdt( ADT* adt ) -{ - for (std::vector::iterator itr = adt->MapChunks.begin(); itr != adt->MapChunks.end(); ++itr) - { - std::vector > tmp; - tmp.reserve((*itr)->Triangles.size()); - for (std::vector >::iterator itr2 = (*itr)->Triangles.begin(); itr2 != (*itr)->Triangles.end(); ++itr2) - tmp.push_back(Triangle(itr2->Type, itr2->V0, itr2->V1, itr2->V2)); - AddData((*itr)->Vertices, tmp); - } - - if (!adt->_DoodadHandler->Triangles.empty()) - AddData(adt->_DoodadHandler->Vertices, adt->_DoodadHandler->Triangles); - - if (!adt->_WorldModelHandler->Triangles.empty()) - AddData(adt->_WorldModelHandler->Vertices, adt->_WorldModelHandler->Triangles); -} - diff --git a/src/tools/mesh_extractor/Geometry.h b/src/tools/mesh_extractor/Geometry.h deleted file mode 100644 index 0bef60e16f..0000000000 --- a/src/tools/mesh_extractor/Geometry.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef GEOMETRY_H -#define GEOMETRY_H -#include - -#include "Utils.h" - -class ADT; -class Geometry -{ -public: - Geometry(); - - void CalculateBoundingBox(float*& min, float*& max); - void CalculateMinMaxHeight(float& min, float& max); - void AddData(std::vector& verts, std::vector >& tris); - void AddAdt(ADT* adt); - void GetRawData(float*& verts, int*& tris, uint8*& areas); - - std::vector Vertices; - std::vector > Triangles; - bool Transform; -}; -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/LiquidHandler.cpp b/src/tools/mesh_extractor/LiquidHandler.cpp deleted file mode 100644 index 1025c10da5..0000000000 --- a/src/tools/mesh_extractor/LiquidHandler.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "LiquidHandler.h" -#include "Utils.h" - -LiquidHandler::LiquidHandler( ADT* adt ) : Source(adt) -{ - HandleNewLiquid(); -} - -void LiquidHandler::HandleNewLiquid() -{ - Chunk* chunk = Source->Data->GetChunkByName("MH2O"); - if (!chunk) - return; - - Vertices.reserve(1000); - Triangles.reserve(1000); - - FILE* stream = chunk->GetStream(); - H2OHeader header[256]; - MCNKData.reserve(256); - for (int i = 0; i < 256; i++) - header[i] = H2OHeader::Read(stream); - - for (int i = 0; i < 256; i++) - { - H2OHeader h = header[i]; - if (h.LayerCount == 0) - { - // Need to fill in missing data with dummies. - MCNKData.push_back(MCNKLiquidData(NULL, H2ORenderMask())); - continue; - } - fseek(stream, chunk->Offset + h.OffsetInformation, SEEK_SET); - H2OInformation information = H2OInformation::Read(stream); - - float** heights = new float*[9]; - for (int j = 0; j < 9; ++j) - { - heights[j] = new float[9]; - memset(heights[j], 0, sizeof(float) * 9); - } - - H2ORenderMask renderMask; - if (information.LiquidType != 2) - { - fseek(stream, chunk->Offset + h.OffsetRender, SEEK_SET); - renderMask = H2ORenderMask::Read(stream); - if ((Utils::IsAllZero(renderMask.Mask, 8) || (information.Width == 8 && information.Height == 8)) && information.OffsetMask2) - { - fseek(stream, chunk->Offset + information.OffsetMask2, SEEK_SET); - uint32 size = ceil(information.Width * information.Height / 8.0f); - uint8* altMask = new uint8[size]; - if (fread(altMask, sizeof(uint8), size, stream) == size) - for (uint32 mi = 0; mi < size; mi++) - renderMask.Mask[mi + information.OffsetY] |= altMask[mi]; - delete[] altMask; - } - fseek(stream, chunk->Offset + information.OffsetHeightmap, SEEK_SET); - - for (int y = information.OffsetY; y < (information.OffsetY + information.Height); y++) - for (int x = information.OffsetX; x < (information.OffsetX + information.Width); x++) - if (fread(&heights[x][y], sizeof(float), 1, stream) != 1) - return; - } - else - { - // Fill with ocean data - for (uint32 i = 0; i < 8; ++i) - renderMask.Mask[i] = 0xFF; - - for (uint32 y = 0; y < 9; ++y) - for (uint32 x = 0; x < 9; ++x) - heights[x][y] = information.HeightLevel1; - } - - MCNKData.push_back(MCNKLiquidData(heights, renderMask)); - - for (int y = information.OffsetY; y < (information.OffsetY + information.Height); y++) - { - for (int x = information.OffsetX; x < (information.OffsetX + information.Width); x++) - { - if (!renderMask.ShouldRender(x, y)) - continue; - - MapChunk* mapChunk = Source->MapChunks[i]; - Vector3 location = mapChunk->Header.Position; - location.y = location.y - (x * Constants::UnitSize); - location.x = location.x - (y * Constants::UnitSize); - location.z = heights[x][y]; - - uint32 vertOffset = Vertices.size(); - Vertices.push_back(location); - Vertices.push_back(Vector3(location.x - Constants::UnitSize, location.y, location.z)); - Vertices.push_back(Vector3(location.x, location.y - Constants::UnitSize, location.z)); - Vertices.push_back(Vector3(location.x - Constants::UnitSize, location.y - Constants::UnitSize, location.z)); - - Triangles.push_back(Triangle(Constants::TRIANGLE_TYPE_WATER, vertOffset, vertOffset+2, vertOffset + 1)); - Triangles.push_back(Triangle(Constants::TRIANGLE_TYPE_WATER, vertOffset + 2, vertOffset + 3, vertOffset + 1)); - } - } - } -} diff --git a/src/tools/mesh_extractor/LiquidHandler.h b/src/tools/mesh_extractor/LiquidHandler.h deleted file mode 100644 index 61fdd213c6..0000000000 --- a/src/tools/mesh_extractor/LiquidHandler.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef LIQUID_H -#define LIQUID_H -#include "ADT.h" -#include "Utils.h" -#include "Define.h" - -#include - -class LiquidHandler -{ -public: - LiquidHandler(ADT* adt); - - ADT* Source; - std::vector Vertices; - std::vector > Triangles; - std::vector MCNKData; -private: - void HandleNewLiquid(); -}; -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/MPQ.cpp b/src/tools/mesh_extractor/MPQ.cpp deleted file mode 100644 index 7bb882ac70..0000000000 --- a/src/tools/mesh_extractor/MPQ.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "MPQ.h" -#include "MPQManager.h" -#include -#include - -MPQArchive::MPQArchive(const char* filename) -{ - int result = libmpq__archive_open(&mpq_a, filename, -1); - printf("Opening %s\n", filename); - if (result) - { - switch (result) - { - case LIBMPQ_ERROR_OPEN : - printf("Error opening archive '%s': Does file really exist?\n", filename); - break; - case LIBMPQ_ERROR_FORMAT : /* bad file format */ - printf("Error opening archive '%s': Bad file format\n", filename); - break; - case LIBMPQ_ERROR_SEEK : /* seeking in file failed */ - printf("Error opening archive '%s': Seeking in file failed\n", filename); - break; - case LIBMPQ_ERROR_READ : /* Read error in archive */ - printf("Error opening archive '%s': Read error in archive\n", filename); - break; - case LIBMPQ_ERROR_MALLOC : /* maybe not enough memory? :) */ - printf("Error opening archive '%s': Maybe not enough memory\n", filename); - break; - default: - printf("Error opening archive '%s': Unknown error\n", filename); - break; - } - } - GetFileListTo(Files); -} - -void MPQArchive::close() -{ - libmpq__archive_close(mpq_a); -} - -MPQFile::MPQFile(const char* filename): -eof(false), buffer(0), pointer(0), size(0) -{ - for (std::deque::iterator i = MPQHandler->Archives.begin(); i != MPQHandler->Archives.end();++i) - { - mpq_archive* mpq_a = (*i)->mpq_a; - - uint32_t filenum; - if(libmpq__file_number(mpq_a, filename, &filenum)) - continue; - libmpq__off_t transferred; - libmpq__file_unpacked_size(mpq_a, filenum, &size); - - // HACK: in patch.mpq some files don't want to open and give 1 for filesize - if (size<=1) { - // printf("warning: file %s has size %d; cannot Read.\n", filename, size); - eof = true; - buffer = 0; - return; - } - buffer = new char[size]; - - //libmpq_file_getdata - libmpq__file_read(mpq_a, filenum, (unsigned char*)buffer, size, &transferred); - /*libmpq_file_getdata(&mpq_a, hash, fileno, (unsigned char*)buffer);*/ - return; - - } - eof = true; - buffer = 0; -} - -size_t MPQFile::Read(void* dest, size_t bytes) -{ - if (eof) - return 0; - - size_t rpos = pointer + bytes; - if (rpos > size_t(size)) { - bytes = size - pointer; - eof = true; - } - - memcpy(dest, &(buffer[pointer]), bytes); - - pointer = rpos; - - return bytes; -} - -void MPQFile::seek(int offset) -{ - pointer = offset; - eof = (pointer >= size); -} - -void MPQFile::seekRelative(int offset) -{ - pointer += offset; - eof = (pointer >= size); -} - -void MPQFile::close() -{ - delete[] buffer; - buffer = 0; - eof = true; -} - -FILE* MPQFile::GetFileStream() -{ - FILE* file = tmpfile(); - if (!file) - { - printf("Could not create temporary file. Please run as Administrator or root\n"); - exit(1); - } - fwrite(buffer, sizeof(char), size, file); - fseek(file, 0, SEEK_SET); - return file; -} diff --git a/src/tools/mesh_extractor/MPQ.h b/src/tools/mesh_extractor/MPQ.h deleted file mode 100644 index a5a9c7a77d..0000000000 --- a/src/tools/mesh_extractor/MPQ.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef MPQ_H -#define MPQ_H - -#include "libmpq/mpq.h" -#include "Define.h" -#include -#include -#include -#include -#include - -class MPQArchive -{ - -public: - mpq_archive_s *mpq_a; - - std::vector Files; - - MPQArchive(const char* filename); - void close(); - - void GetFileListTo(std::vector& filelist) { - uint32_t filenum; - if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return; - libmpq__off_t size, transferred; - libmpq__file_unpacked_size(mpq_a, filenum, &size); - - char* buffer = new char[size + 1]; - buffer[size] = '\0'; - - libmpq__file_read(mpq_a, filenum, (unsigned char*)buffer, size, &transferred); - - char seps[] = "\n"; - char* token; - - token = strtok( buffer, seps ); - uint32 counter = 0; - while ((token != NULL) && (counter < size)) { - //cout << token << endl; - token[strlen(token) - 1] = 0; - std::string s = token; - filelist.push_back(s); - counter += strlen(token) + 2; - token = strtok(NULL, seps); - } - - delete[] buffer; - } -}; - -class MPQFile -{ - //MPQHANDLE handle; - bool eof; - char *buffer; - libmpq__off_t pointer,size; - - // disable copying - MPQFile(const MPQFile& /*f*/) {} - void operator=(const MPQFile& /*f*/) {} - -public: - MPQFile(const char* filename); // filenames are not case sensitive - ~MPQFile() { close(); } - size_t Read(void* dest, size_t bytes); - FILE* GetFileStream(); - size_t getSize() { return size; } - size_t getPos() { return pointer; } - char* getBuffer() { return buffer; } - char* getPointer() { return buffer + pointer; } - bool isEof() { return eof; } - void seek(int offset); - void seekRelative(int offset); - void close(); -}; - -inline void flipcc(char *fcc) -{ - char t; - t=fcc[0]; - fcc[0]=fcc[3]; - fcc[3]=t; - t=fcc[1]; - fcc[1]=fcc[2]; - fcc[2]=t; -} - -#endif diff --git a/src/tools/mesh_extractor/MPQManager.cpp b/src/tools/mesh_extractor/MPQManager.cpp deleted file mode 100644 index cef6feb642..0000000000 --- a/src/tools/mesh_extractor/MPQManager.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "MPQManager.h" -#include "MPQ.h" -#include "DBC.h" -#include "Utils.h" -#include - -char const* MPQManager::Files[] = { - "common.MPQ", - "common-2.MPQ", - "expansion.MPQ", - "lichking.MPQ", - "patch.MPQ", - "patch-2.MPQ", - "patch-3.MPQ" -}; - -char const* MPQManager::Languages[] = { "enGB", "enUS", "deDE", "esES", "frFR", "koKR", "zhCN", "zhTW", "enCN", "enTW", "esMX", "ruRU" }; - -void MPQManager::Initialize() -{ - InitializeDBC(); - uint32 size = sizeof(Files) / sizeof(char*); - for (uint32 i = 0; i < size; ++i) - { - MPQArchive* arc = new MPQArchive(std::string("Data/" + std::string(Files[i])).c_str()); - Archives.push_front(arc); // MPQ files have to be transversed in reverse order to properly account for patched files - printf("Opened %s\n", Files[i]); - } -} - -void MPQManager::InitializeDBC() -{ - BaseLocale = -1; - std::string fileName; - uint32 size = sizeof(Languages) / sizeof(char*); - MPQArchive* _baseLocale = NULL; - for (uint32 i = 0; i < size; ++i) - { - std::string _fileName = "Data/" + std::string(Languages[i]) + "/locale-" + std::string(Languages[i]) + ".MPQ"; - FILE* file = fopen(_fileName.c_str(), "rb"); - if (file) - { - if (BaseLocale == -1) - { - BaseLocale = i; - _baseLocale = new MPQArchive(_fileName.c_str()); - fileName = _fileName; - LocaleFiles[i] = _baseLocale; - } - else - LocaleFiles[i] = new MPQArchive(_fileName.c_str()); - - AvailableLocales.insert(i); - printf("Detected locale: %s\n", Languages[i]); - } - } - Archives.push_front(_baseLocale); - if (BaseLocale == -1) - { - printf("No locale data detected. Please make sure that the executable is in the same folder as your WoW installation.\n"); - ASSERT(false); - } - else - printf("Using default locale: %s\n", Languages[BaseLocale]); -} - -FILE* MPQManager::GetFile(const std::string& path ) -{ - ACE_GUARD_RETURN(ACE_Thread_Mutex, g, mutex, NULL); - MPQFile file(path.c_str()); - if (file.isEof()) - return NULL; - return file.GetFileStream(); -} - -DBC* MPQManager::GetDBC(const std::string& name ) -{ - std::string path = "DBFilesClient\\" + name + ".dbc"; - return new DBC(GetFile(path)); -} - -FILE* MPQManager::GetFileFrom(const std::string& path, MPQArchive* file ) -{ - ACE_GUARD_RETURN(ACE_Thread_Mutex, g, mutex, NULL); - mpq_archive* mpq_a = file->mpq_a; - - uint32_t filenum; - if(libmpq__file_number(mpq_a, path.c_str(), &filenum)) - return NULL; - - libmpq__off_t transferred; - libmpq__off_t size = 0; - libmpq__file_unpacked_size(mpq_a, filenum, &size); - - // HACK: in patch.mpq some files don't want to open and give 1 for filesize - if (size <= 1) - return NULL; - - uint8* buffer = new uint8[size]; - - //libmpq_file_getdata - libmpq__file_read(mpq_a, filenum, (unsigned char*)buffer, size, &transferred); - - // Pack the return into a FILE stream - FILE* ret = tmpfile(); - if (!ret) - { - printf("Could not create temporary file. Please run as Administrator or root\n"); - exit(1); - } - fwrite(buffer, sizeof(uint8), size, ret); - fseek(ret, 0, SEEK_SET); - delete[] buffer; - return ret; -} diff --git a/src/tools/mesh_extractor/MPQManager.h b/src/tools/mesh_extractor/MPQManager.h deleted file mode 100644 index 4341926922..0000000000 --- a/src/tools/mesh_extractor/MPQManager.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef MPQ_MANAGER_H -#define MPQ_MANAGER_H - -#include "MPQ.h" -#include -#include -#include - -class DBC; -class MPQManager -{ -public: - MPQManager() {} - ~MPQManager() {} - - void Initialize(); - FILE* GetFile(const std::string& path); - FILE* GetFileFrom(const std::string& path, MPQArchive* file); - DBC* GetDBC(const std::string& name); - std::vector GetAllFiles(std::string extension); - - std::deque Archives; - int32 BaseLocale; - std::set AvailableLocales; - std::map LocaleFiles; - - static char const* Files[]; - static char const* Languages[]; -protected: - void InitializeDBC(); -private: - ACE_Thread_Mutex mutex; -}; - -extern MPQManager* MPQHandler; -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/MapChunk.cpp b/src/tools/mesh_extractor/MapChunk.cpp deleted file mode 100644 index d21815ebd8..0000000000 --- a/src/tools/mesh_extractor/MapChunk.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "MapChunk.h" -#include "ADT.h" -#include "LiquidHandler.h" - -MapChunk::MapChunk( ADT* _adt, Chunk* chunk ) : Adt(_adt), Source(chunk) -{ - FILE* stream = chunk->GetStream(); - Header.Read(stream); - fseek(stream, chunk->Offset, SEEK_SET); - Index = Header.IndexX + Header.IndexY * 16; - GenerateVertices(stream); -} - -void MapChunk::GenerateTriangles() -{ - Triangles.reserve(256); - for (int y = 0; y < 8; y++) - { - for (int x = 0; x < 8; x++) - { - if (HasHole(Header.Holes, x / 2, y / 2)) - continue; - - uint32 topLeft = (17 * y) + x; - uint32 topRight = (17 * y) + x + 1; - uint32 bottomLeft = (17 * (y + 1)) + x; - uint32 bottomRight = (17 * (y + 1)) + x + 1; - uint32 center = (17 * y) + 9 + x; - - Constants::TriangleType triangleType = Constants::TRIANGLE_TYPE_TERRAIN; - if (Adt->_LiquidHandler && !Adt->_LiquidHandler->MCNKData.empty()) - { - MCNKLiquidData& data = Adt->_LiquidHandler->MCNKData[Index]; - float maxHeight = std::max( - std::max( - std::max(std::max(Vertices[topLeft].z, Vertices[topRight].z), Vertices[bottomLeft].z), - Vertices[bottomRight].z), Vertices[center].z); - if (data.IsWater(x, y, maxHeight)) - triangleType = Constants::TRIANGLE_TYPE_WATER; - } - - Triangles.push_back(Triangle(triangleType, topRight, topLeft, center)); - Triangles.push_back(Triangle(triangleType, topLeft, bottomLeft, center)); - Triangles.push_back(Triangle(triangleType, bottomLeft, bottomRight, center)); - Triangles.push_back(Triangle(triangleType, bottomRight, topRight, center)); - } - } -} - -void MapChunk::GenerateVertices( FILE* stream ) -{ - fseek(stream, Header.OffsetMCVT, SEEK_CUR); - Vertices.reserve(125); - - for (int j = 0; j < 17; j++) - { - int values = j % 2 ? 8 : 9; - for (int i = 0; i < values; i++) - { - float tmp; - if (fread(&tmp, sizeof(float), 1, stream) != 1) - printf("MapChunk::GenerateVertices: Failed to read some data expected 1, read 0\n"); - Vector3 vert(Header.Position.x - (j * (Constants::UnitSize * 0.5f)), Header.Position.y - (i * Constants::UnitSize), Header.Position.z + tmp); - if (values == 8) - vert.y -= Constants::UnitSize * 0.5f; - Vertices.push_back(vert); - } - } - // Restore stream position. - fseek(stream, Source->Offset, SEEK_SET); -} - -bool MapChunk::HasHole( uint32 map, int x, int y ) -{ - return (map & 0x0000FFFF) & ((1 << x) << (y << 2)); -} diff --git a/src/tools/mesh_extractor/MapChunk.h b/src/tools/mesh_extractor/MapChunk.h deleted file mode 100644 index 4787317873..0000000000 --- a/src/tools/mesh_extractor/MapChunk.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef MAPCHUNK_H -#define MAPCHUNK_H -#include "Chunk.h" -#include "Utils.h" -#include "Constants.h" -#include -class ADT; - -class MapChunk -{ -public: - MapChunk(ADT* _adt, Chunk* chunk); - - void GenerateTriangles(); - void GenerateVertices(FILE* stream); - static bool HasHole(uint32 map, int x, int y); - ADT* Adt; - Chunk* Source; - MapChunkHeader Header; - std::vector Vertices; - std::vector > Triangles; - int32 Index; -}; -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/MeshExtractor.cpp b/src/tools/mesh_extractor/MeshExtractor.cpp deleted file mode 100644 index 08afb93194..0000000000 --- a/src/tools/mesh_extractor/MeshExtractor.cpp +++ /dev/null @@ -1,486 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "MPQManager.h" -#include "WDT.h" -#include "ContinentBuilder.h" -#include "Cache.h" -#include "DBC.h" -#include "Constants.h" -#include "Model.h" - -#include "Recast.h" -#include "DetourNavMesh.h" -#include "DetourNavMeshQuery.h" - -#include - -#include - -MPQManager* MPQHandler; -CacheClass* Cache; - -void ExtractMMaps(std::set& mapIds, uint32 threads) -{ - DBC* dbc = MPQHandler->GetDBC("Map"); - printf("Map.dbc contains %u rows.\n", dbc->Records.size()); - for (std::vector::iterator itr = dbc->Records.begin(); itr != dbc->Records.end(); ++itr) - { - uint32 mapId = (*itr)->Values[0]; - - // Skip this map if a list of specific maps was provided and this one is not contained in it. - if (!mapIds.empty() && mapIds.find(mapId) == mapIds.end()) - { - if (Constants::Debug) - printf("Map %u will not be built.\n", mapId); - continue; - } - - std::string name = (*itr)->GetString(1); - WDT wdt("World\\maps\\" + name + "\\" + name + ".wdt"); - if (!wdt.IsValid) - { - printf("Could not find WDT data for map %u (%s)\n", mapId, name.c_str()); - continue; - } - printf("Building %s MapId %u\n", name.c_str(), mapId); - ContinentBuilder builder(name, mapId, &wdt, threads); - builder.Build(); - } -} - -void ExtractDBCs() -{ - printf("Extracting DBCs\n"); - // Create the file system structure - std::string baseDBCPath = "dbc/"; - Utils::CreateDir(baseDBCPath); - - std::set DBCFiles; - const size_t extLen = strlen(".dbc"); - // Populate list of DBC files - // We get the DBC names by going over the (guaranteed to exist) default locale files - // Then we look in other locale files in case that they are available. - for (std::vector::iterator itr = MPQHandler->LocaleFiles[MPQHandler->BaseLocale]->Files.begin(); itr != MPQHandler->LocaleFiles[MPQHandler->BaseLocale]->Files.end(); ++itr) - if (itr->rfind(".dbc") == itr->length() - extLen) // Check if the extension is ".dbc" - DBCFiles.insert(*itr); - - const size_t folderLen = strlen("DBFilesClient\\"); - // Iterate over all available locales - for (std::set::iterator itr = MPQHandler->AvailableLocales.begin(); itr != MPQHandler->AvailableLocales.end(); ++itr) - { - printf("Extracting DBCs for locale %s\n", MPQManager::Languages[*itr]); - std::string path = baseDBCPath; - if (*itr != uint32(MPQHandler->BaseLocale)) - { - path += std::string(MPQManager::Languages[*itr]) + "/"; - Utils::CreateDir(path); - } - - std::string component = "component.wow-" + std::string(MPQManager::Languages[*itr]) + ".txt"; - // Extract the component file - Utils::SaveToDisk(MPQHandler->GetFileFrom(component, MPQHandler->LocaleFiles[*itr]), path + component); - // Extract the DBC files for the given locale - for (std::set::iterator itr2 = DBCFiles.begin(); itr2 != DBCFiles.end(); ++itr2) - Utils::SaveToDisk(MPQHandler->GetFileFrom(*itr2, MPQHandler->LocaleFiles[*itr]), path + (itr2->c_str() + folderLen)); - } - printf("DBC extraction finished!\n"); -} - -void ExtractGameobjectModels() -{ - Constants::ToWoWCoords = true; - printf("Extracting GameObject models\n"); - - std::string baseBuildingsPath = "Buildings/"; - std::string baseVmapsPath = "vmaps/"; - Utils::CreateDir(baseVmapsPath); - Utils::CreateDir(baseBuildingsPath); - - FILE* modelList = fopen((baseVmapsPath + "GameObjectModels.list").c_str(), "wb"); - if (!modelList) - { - printf("Could not create file vmaps/GameObjectModels.list, please make sure that you have the write permissions in the folder\n"); - return; - } - - DBC* dbc = MPQHandler->GetDBC("GameObjectDisplayInfo"); - for (std::vector::iterator itr = dbc->Records.begin(); itr != dbc->Records.end(); ++itr) - { - std::string path = (*itr)->GetString(1); - std::string fileName = Utils::GetPlainName(path.c_str()); - std::string extension = Utils::GetExtension(fileName); - // Convert the extension to lowercase - std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); - if (extension == "mdx" || extension == "m2") - { - fileName = Utils::FixModelPath(fileName); - Model model(path); - - if (model.IsBad) - continue; - - FILE* output = fopen((baseBuildingsPath + fileName).c_str(), "wb"); - if (!output) - { - printf("Could not create file %s, please check that you have write permissions\n", (baseBuildingsPath + fileName).c_str()); - continue; - } - // Placeholder for 0 values - int Nop[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - - fwrite(Constants::VMAPMagic, 8, 1, output); - uint32 numVerts = model.Header.CountBoundingVertices; - fwrite(&numVerts, sizeof(uint32), 1, output); - uint32 numGroups = 1; - fwrite(&numGroups, sizeof(uint32), 1, output); - fwrite(Nop, 4 * 3 , 1, output); // rootwmoid, flags, groupid - fwrite(Nop, sizeof(float), 3 * 2, output);//bbox, only needed for WMO currently - fwrite(Nop, 4, 1, output);// liquidflags - fwrite("GRP ", 4, 1, output); - - uint32 branches = 1; - uint32 wsize = sizeof(branches) + sizeof(uint32) * branches; - fwrite(&wsize, sizeof(uint32), 1, output); - fwrite(&branches, sizeof(branches), 1, output); - uint32 numTris = model.Header.CountBoundingTriangles; - fwrite(&numTris, sizeof(uint32), 1, output); - fwrite("INDX", 4, 1, output); - wsize = sizeof(uint32) + sizeof(unsigned short) * numTris; - fwrite(&wsize, sizeof(int), 1, output); - fwrite(&numTris, sizeof(uint32), 1, output); - uint16* indices = new uint16[numTris]; - - if (numTris > 0) - { - uint32 i = 0; - for (std::vector >::iterator itr2 = model.Triangles.begin(); itr2 != model.Triangles.end(); ++itr2, ++i) - { - indices[i * 3 + 0] = itr2->V0; - indices[i * 3 + 1] = itr2->V1; - indices[i * 3 + 2] = itr2->V2; - } - fwrite(indices, sizeof(uint16), numTris, output); - } - - - fwrite("VERT", 4, 1, output); - wsize = sizeof(int) + sizeof(float) * 3 * numVerts; - fwrite(&wsize, sizeof(int), 1, output); - fwrite(&numVerts, sizeof(int), 1, output); - float* vertices = new float[numVerts*3]; - - if (numVerts > 0) - { - uint32 i = 0; - for (std::vector::iterator itr2 = model.Vertices.begin(); itr2 != model.Vertices.end(); ++itr2, ++i) - { - vertices[i * 3 + 0] = itr2->x; - vertices[i * 3 + 1] = itr2->y; - vertices[i * 3 + 2] = itr2->z; - } - - fwrite(vertices, sizeof(float), numVerts * 3, output); - } - - fclose(output); - delete[] indices; - delete[] vertices; - - uint32 displayId = (*itr)->Values[0]; - uint32 pathLength = fileName.size(); - fwrite(&displayId, sizeof(uint32), 1, modelList); - fwrite(&pathLength, sizeof(uint32), 1, modelList); - fwrite(fileName.c_str(), sizeof(char), pathLength, modelList); - } - else if (extension == "wmo") - { - WorldModelRoot model(path); - - FILE* output = fopen((baseBuildingsPath + fileName).c_str(), "wb"); - if (!output) - { - printf("Could not create file %s, please check that you have write permissions\n", (baseBuildingsPath + fileName).c_str()); - continue; - } - - fwrite(Constants::VMAPMagic, 1, 8, output); - uint32 numVertices = 0; - fwrite(&numVertices, sizeof(uint32), 1, output); // will be filled later - fwrite(&model.Header.CountGroups, sizeof(uint32), 1, output); - fwrite(&model.Header.WmoId, sizeof(uint32), 1, output); - - const char grp[] = { 'G' , 'R' , 'P', ' ' }; - for (std::vector::iterator itr2 = model.Groups.begin(); itr2 != model.Groups.end(); ++itr2) - { - const WMOGroupHeader& header = itr2->Header; - fwrite(&header.Flags, sizeof(uint32), 1, output); - fwrite(&header.WmoId, sizeof(uint32), 1, output); - fwrite(&header.BoundingBox[0], sizeof(uint32), 1, output); - fwrite(&header.BoundingBox[1], sizeof(uint32), 1, output); - uint32 LiquidFlags = itr2->HasLiquidData ? 1 : 0; - fwrite(&LiquidFlags, sizeof(uint32), 1, output); - - fwrite(grp, sizeof(char), sizeof(grp), output); - uint32 k = 0; - uint32 mobaBatch = itr2->MOBALength / 12; - uint32* MobaEx = new uint32[mobaBatch*4]; - - for(uint32 i = 8; i < itr2->MOBALength; i += 12) - MobaEx[k++] = itr2->MOBA[i]; - - int mobaSizeGrp = mobaBatch * 4 + 4; - fwrite(&mobaSizeGrp, 4, 1, output); - fwrite(&mobaBatch, 4, 1, output); - fwrite(MobaEx, 4, k, output); - delete[] MobaEx; - - //@TODO: Finish this. - } - - fclose(output); - } - } - - fclose(modelList); - printf("GameObject models extraction finished!"); - Constants::ToWoWCoords = false; -} - -bool HandleArgs(int argc, char** argv, uint32& threads, std::set& mapList, bool& debugOutput, uint32& extractFlags) -{ - char* param = NULL; - extractFlags = 0; - - for (int i = 1; i < argc; ++i) - { - if (strcmp(argv[i], "--threads") == 0) - { - param = argv[++i]; - if (!param) - return false; - - threads = atoi(param); - printf("Using %u threads\n", threads); - } - else if (strcmp(argv[i], "--maps") == 0) - { - param = argv[++i]; - if (!param) - return false; - - char* copy = strdup(param); - char* token = strtok(copy, ","); - while (token) - { - mapList.insert(atoi(token)); - token = strtok(NULL, ","); - } - - free(copy); - - printf("Extracting only provided list of maps (%u).\n", uint32(mapList.size())); - } - else if (strcmp(argv[i], "--debug") == 0) - { - param = argv[++i]; - if (!param) - return false; - debugOutput = atoi(param); - if (debugOutput) - printf("Output will contain debug information (.obj files)\n"); - } - else if (strcmp(argv[i], "--extract") == 0) - { - param = argv[++i]; - if (!param) - return false; - - extractFlags = atoi(param); - - if (!(extractFlags & Constants::EXTRACT_FLAG_ALLOWED)) // Tried to use an invalid flag - return false; - - printf("Detected flags: \n"); - printf("* Extract DBCs: %s\n", (extractFlags & Constants::EXTRACT_FLAG_DBC) ? "Yes" : "No"); - printf("* Extract Maps: %s\n", (extractFlags & Constants::EXTRACT_FLAG_MAPS) ? "Yes" : "No"); - printf("* Extract VMaps: %s\n", (extractFlags & Constants::EXTRACT_FLAG_VMAPS) ? "Yes" : "No"); - printf("* Extract GameObject Models: %s\n", (extractFlags & Constants::EXTRACT_FLAG_GOB_MODELS) ? "Yes" : "No"); - printf("* Extract MMaps: %s\n", (extractFlags & Constants::EXTRACT_FLAG_MMAPS) ? "Yes" : "No"); - } - } - return true; -} - -void PrintUsage() -{ - printf("MeshExtractor help.\n"); - printf("* Use \"--threads \" to specify threads, default to 4 (Only available when extracting MMaps)\n"); - printf("* Use \"--maps a,b,c,d,e\" to extract only the maps specified (Do not use spaces)\n"); - printf("* Use \"--debug 1\" to generate debug information of the tiles (Only available when extracting MMaps)\n"); - printf("* Use \"--extract X\" to extract the data specified by the flag X (Note: You can combine the flags with the bitwise OR operator |). Available flags are: \n"); - { - printf("- %u to extract DBCs\n", Constants::EXTRACT_FLAG_DBC); - printf("- %u to extract Maps (Not yet implemented)\n", Constants::EXTRACT_FLAG_MAPS); - printf("- %u to extract VMaps (Not yet implemented)\n", Constants::EXTRACT_FLAG_VMAPS); - printf("- %u to extract GameObject models (Not yet finished, you need to run VMapAssembler on the extracted files)\n", Constants::EXTRACT_FLAG_GOB_MODELS); - printf("- %u to extract MMaps (Not yet finished)\n", Constants::EXTRACT_FLAG_MMAPS); - } -} - -void LoadTile(dtNavMesh*& navMesh, const char* tile) -{ - FILE* f = fopen(tile, "rb"); - if (!f) - return; - MmapTileHeader header; - - if (fread(&header, sizeof(MmapTileHeader), 1, f) != 1) - return; - - uint8* nav = new uint8[header.size]; - if (fread(nav, header.size, 1, f) != 1) - return; - - navMesh->addTile(nav, header.size, DT_TILE_FREE_DATA, 0, NULL); - - fclose(f); -} - -int main(int argc, char* argv[]) -{ - _setmaxstdio(2048); - uint32 threads = 4, extractFlags = 0; - std::set mapIds; - - if (!HandleArgs(argc, argv, threads, mapIds, Constants::Debug, extractFlags)) - { - PrintUsage(); - return -1; - } - - if (extractFlags == 0) - { - printf("You must provide valid extract flags.\n"); - PrintUsage(); - return -1; - } - - Cache = new CacheClass(); - MPQHandler = new MPQManager(); - MPQHandler->Initialize(); - - if (extractFlags & Constants::EXTRACT_FLAG_DBC) - ExtractDBCs(); - - if (extractFlags & Constants::EXTRACT_FLAG_MMAPS) - ExtractMMaps(mapIds, threads); - - if (extractFlags & Constants::EXTRACT_FLAG_GOB_MODELS) - ExtractGameobjectModels(); - - if (extractFlags & Constants::EXTRACT_FLAG_TEST) - { - float start[] = { 16226.200195f, 16257.000000f, 13.202200f }; - float end[] = { 16245.725586f, 16382.465820f, 47.384956f }; - - // - float m_spos[3]; - m_spos[0] = -start[1]; - m_spos[1] = start[2]; - m_spos[2] = -start[0]; - - // - float m_epos[3]; - m_epos[0] = -end[1]; - m_epos[1] = end[2]; - m_epos[2] = -end[0]; - - // - dtQueryFilter m_filter; - m_filter.setIncludeFlags(Constants::POLY_AREA_ROAD | Constants::POLY_AREA_TERRAIN); - m_filter.setExcludeFlags(Constants::POLY_AREA_WATER); - - // - float m_polyPickExt[3]; - m_polyPickExt[0] = 2.5f; - m_polyPickExt[1] = 2.5f; - m_polyPickExt[2] = 2.5f; - - // - dtPolyRef m_startRef; - dtPolyRef m_endRef; - - FILE* mmap = fopen("mmaps/001.mmap", "rb"); - dtNavMeshParams params; - int count = fread(¶ms, sizeof(dtNavMeshParams), 1, mmap); - fclose(mmap); - if (count != 1) - { - printf("main: Error reading from .mmap\n"); - return 0; - } - - dtNavMesh* navMesh = new dtNavMesh(); - dtNavMeshQuery* navMeshQuery = new dtNavMeshQuery(); - - navMesh->init(¶ms); - for (int i = 0; i <= 32; ++i) - { - for (int j = 0; j <= 32; ++j) - { - char buff[100]; - sprintf(buff, "mmaps/001%02i%02i.mmtile", i, j); - LoadTile(navMesh, buff); - } - } - - navMeshQuery->init(navMesh, 2048); - - float nearestPt[3]; - - navMeshQuery->findNearestPoly(m_spos, m_polyPickExt, &m_filter, &m_startRef, nearestPt); - navMeshQuery->findNearestPoly(m_epos, m_polyPickExt, &m_filter, &m_endRef, nearestPt); - - if ( !m_startRef || !m_endRef ) - { - std::cerr << "Could not find any nearby poly's (" << m_startRef << "," << m_endRef << ")" << std::endl; - return 0; - } - - int hops; - dtPolyRef* hopBuffer = new dtPolyRef[8192]; - dtStatus status = navMeshQuery->findPath(m_startRef, m_endRef, m_spos, m_epos, &m_filter, hopBuffer, &hops, 8192); - - int resultHopCount; - float* straightPath = new float[2048*3]; - unsigned char* pathFlags = new unsigned char[2048]; - dtPolyRef* pathRefs = new dtPolyRef[2048]; - - status = navMeshQuery->findStraightPath(m_spos, m_epos, hopBuffer, hops, straightPath, pathFlags, pathRefs, &resultHopCount, 2048); - std::vector FinalPath; - FinalPath.reserve(resultHopCount); - for (uint32 i = 0; i < resultHopCount; ++i) - { - Vector3 finalV = Utils::ToWoWCoords(Vector3(straightPath[i * 3 + 0], straightPath[i * 3 + 1], straightPath[i * 3 + 2])); - FinalPath.push_back(finalV); - printf("Point %f %f %f\n", finalV.x, finalV.y, finalV.z); - } - } - - return 0; -} diff --git a/src/tools/mesh_extractor/Model.cpp b/src/tools/mesh_extractor/Model.cpp deleted file mode 100644 index ce9132bd4a..0000000000 --- a/src/tools/mesh_extractor/Model.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "Model.h" -#include "MPQManager.h" -#include "Utils.h" - -Model::Model( std::string path ) : IsCollidable(false), IsBad(false) -{ - Stream = MPQHandler->GetFile(Utils::FixModelPath(path)); - if (!Stream) - { - IsBad = true; - return; - } - Header.Read(Stream); - if (Header.OffsetBoundingNormals > 0 && Header.OffsetBoundingVertices > 0 && - Header.OffsetBoundingTriangles > 0 && Header.BoundingRadius > 0.0f) - { - IsCollidable = true; - ReadVertices(); - ReadBoundingNormals(); - ReadBoundingTriangles(); - } -} - -Model::~Model() -{ - if (Stream) - fclose(Stream); -} - -void Model::ReadVertices() -{ - fseek(Stream, Header.OffsetBoundingVertices, SEEK_SET); - Vertices.reserve(Header.CountBoundingVertices); - for (uint32 i = 0; i < Header.CountBoundingVertices; ++i) - { - Vertices.push_back(Vector3::Read(Stream)); - if (Constants::ToWoWCoords) - Vertices[i] = Utils::ToWoWCoords(Vertices[i]); - } -} - -void Model::ReadBoundingTriangles() -{ - fseek(Stream, Header.OffsetBoundingTriangles, SEEK_SET); - Triangles.reserve(Header.CountBoundingTriangles / 3); - for (uint32 i = 0; i < Header.CountBoundingTriangles / 3; i++) - { - Triangle tri; - tri.Type = Constants::TRIANGLE_TYPE_DOODAD; - int count = 0; - count += fread(&tri.V0, sizeof(uint16), 1, Stream); - count += fread(&tri.V1, sizeof(uint16), 1, Stream); - count += fread(&tri.V2, sizeof(uint16), 1, Stream); - if (count != 3) - printf("Model::ReadBoundingTriangles: Error reading data, expected 3, read %d\n", count); - Triangles.push_back(tri); - } -} - -void Model::ReadBoundingNormals() -{ - fseek(Stream, Header.OffsetBoundingNormals, SEEK_SET); - Normals.reserve(Header.CountBoundingNormals); - for (uint32 i = 0; i < Header.CountBoundingNormals; i++) - Normals.push_back(Vector3::Read(Stream)); -} - diff --git a/src/tools/mesh_extractor/Model.h b/src/tools/mesh_extractor/Model.h deleted file mode 100644 index 31899ff219..0000000000 --- a/src/tools/mesh_extractor/Model.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef MODEL_H -#define MODEL_H -#include -#include "Utils.h" - -class Model -{ -public: - Model(std::string path); - ~Model(); - - void ReadVertices(); - void ReadBoundingTriangles(); - void ReadBoundingNormals(); - ModelHeader Header; - std::vector Vertices; - std::vector Normals; - std::vector > Triangles; - bool IsCollidable; - FILE* Stream; - bool IsBad; -}; -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/ObjectDataHandler.cpp b/src/tools/mesh_extractor/ObjectDataHandler.cpp deleted file mode 100644 index 1f7c15fd87..0000000000 --- a/src/tools/mesh_extractor/ObjectDataHandler.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "ObjectDataHandler.h" -#include "Chunk.h" -#include "ADT.h" -#include "ChunkedData.h" - -void ObjectDataHandler::ProcessMapChunk( MapChunk* chunk ) -{ - ProcessInternal(chunk); -} diff --git a/src/tools/mesh_extractor/ObjectDataHandler.h b/src/tools/mesh_extractor/ObjectDataHandler.h deleted file mode 100644 index 5f6674be48..0000000000 --- a/src/tools/mesh_extractor/ObjectDataHandler.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef ODATA_HNDL_H -#define ODATA_HNDL_H -#include "ADT.h" -#include "MapChunk.h" - -class ObjectDataHandler -{ -public: - ObjectDataHandler(ADT* _adt) : Source(_adt) {} - - void ProcessMapChunk(MapChunk* chunk); - virtual void ProcessInternal(MapChunk* data) = 0; - ADT* Source; -}; -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/TileBuilder.cpp b/src/tools/mesh_extractor/TileBuilder.cpp deleted file mode 100644 index d9807603d5..0000000000 --- a/src/tools/mesh_extractor/TileBuilder.cpp +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "ContinentBuilder.h" -#include "TileBuilder.h" -#include "Geometry.h" -#include "WorldModelRoot.h" -#include "Constants.h" -#include "Utils.h" -#include "Cache.h" -#include "ADT.h" -#include "WDT.h" -#include "Recast.h" -#include "RecastAlloc.h" -#include "DetourNavMeshBuilder.h" - -#include - -TileBuilder::TileBuilder(ContinentBuilder* _cBuilder, std::string world, int x, int y, uint32 mapId) : - World(world), X(x), Y(y), MapId(mapId), _Geometry(NULL), DataSize(0), cBuilder(_cBuilder) -{ - // Config for normal maps - memset(&Config, 0, sizeof(rcConfig)); - Config.cs = Constants::TileSize / 1800.0f; // TileSize / voxelSize - Config.ch = 0.3f; - Config.minRegionArea = 36; - Config.mergeRegionArea = 144; - Config.walkableSlopeAngle = 50.0f; - Config.detailSampleDist = 3.0f; - Config.detailSampleMaxError = 1.25f; - Config.walkableClimb = 1.0f / Config.ch; - Config.walkableHeight = 2.1 / Config.ch; - Config.walkableRadius = 0.6f / Config.cs; - Config.maxEdgeLen = Config.walkableRadius * 8; - Config.borderSize = Config.walkableRadius + 8; - Config.tileSize = 1800; - Config.maxSimplificationError = 1.3f; - Config.maxVertsPerPoly = 6; - - // Config for instances - memset(&InstanceConfig, 0, sizeof(rcConfig)); - InstanceConfig.cs = 0.2f; - InstanceConfig.ch = 0.3f; - InstanceConfig.minRegionArea = 25; - InstanceConfig.mergeRegionArea = 100; - InstanceConfig.walkableSlopeAngle = 50.0f; - InstanceConfig.detailSampleDist = 3.0f; - InstanceConfig.detailSampleMaxError = 1.5f; - InstanceConfig.walkableClimb = 1.0f / InstanceConfig.ch; - InstanceConfig.walkableHeight = 2.1f / InstanceConfig.ch; - InstanceConfig.walkableRadius = 0.6f / InstanceConfig.cs; - InstanceConfig.maxEdgeLen = 8 * InstanceConfig.walkableRadius; - InstanceConfig.maxVertsPerPoly = 6; - InstanceConfig.maxSimplificationError = 1.25f; - InstanceConfig.borderSize = 0; - - Context = new rcContext; -} - -void TileBuilder::CalculateTileBounds( float*& bmin, float*& bmax, dtNavMeshParams& /*navMeshParams*/ ) -{ - bmin = new float[3]; - bmax = new float[3]; - bmin[0] = Constants::Origin[0] /*navMeshParams.orig[0]*/ + (Constants::TileSize * X); - bmin[2] = Constants::Origin[2] /*navMeshParams.orig[2]*/ + (Constants::TileSize * Y); - bmax[0] = Constants::Origin[0] /*navMeshParams.orig[0]*/ + (Constants::TileSize * (X + 1)); - bmax[2] = Constants::Origin[2] /*navMeshParams.orig[2]*/ + (Constants::TileSize * (Y + 1)); -} - -void TileBuilder::AddGeometry(WorldModelRoot* root, const WorldModelDefinition& def) -{ - _Geometry = new Geometry(); - _Geometry->Transform = true; - - WorldModelHandler::InsertModelGeometry(_Geometry->Vertices, _Geometry->Triangles, def, root, false); - - OutputDebugVertices(); -} - -uint8* TileBuilder::BuildInstance( dtNavMeshParams& navMeshParams ) -{ - float* bmin = NULL, *bmax = NULL; - - _Geometry->CalculateBoundingBox(bmin, bmax); - - rcVcopy(InstanceConfig.bmax, bmax); - rcVcopy(InstanceConfig.bmin, bmin); - - uint32 numVerts = _Geometry->Vertices.size(); - uint32 numTris = _Geometry->Triangles.size(); - float* vertices; - int* triangles; - uint8* areas; - _Geometry->GetRawData(vertices, triangles, areas); - - // this sets the dimensions of the heightfield - rcCalcGridSize(InstanceConfig.bmin, InstanceConfig.bmax, InstanceConfig.cs, &InstanceConfig.width, &InstanceConfig.height); - - rcHeightfield* hf = rcAllocHeightfield(); - rcCreateHeightfield(Context, *hf, InstanceConfig.width, InstanceConfig.height, InstanceConfig.bmin, InstanceConfig.bmax, InstanceConfig.cs, InstanceConfig.ch); - - rcClearUnwalkableTriangles(Context, InstanceConfig.walkableSlopeAngle, vertices, numVerts, triangles, numTris, areas); - rcRasterizeTriangles(Context, vertices, numVerts, triangles, areas, numTris, *hf, InstanceConfig.walkableClimb); - - rcFilterLowHangingWalkableObstacles(Context, InstanceConfig.walkableClimb, *hf); - rcFilterLedgeSpans(Context, InstanceConfig.walkableHeight, InstanceConfig.walkableClimb, *hf); - rcFilterWalkableLowHeightSpans(Context, InstanceConfig.walkableHeight, *hf); - - rcCompactHeightfield* chf = rcAllocCompactHeightfield(); - rcBuildCompactHeightfield(Context, InstanceConfig.walkableHeight, InstanceConfig.walkableClimb, *hf, *chf); - - rcErodeWalkableArea(Context, InstanceConfig.walkableRadius, *chf); - rcBuildDistanceField(Context, *chf); - rcBuildRegions(Context, *chf, InstanceConfig.borderSize, InstanceConfig.minRegionArea, InstanceConfig.minRegionArea); - - rcContourSet* contours = rcAllocContourSet(); - rcBuildContours(Context, *chf, InstanceConfig.maxSimplificationError, InstanceConfig.maxEdgeLen, *contours); - - rcPolyMesh* pmesh = rcAllocPolyMesh(); - rcBuildPolyMesh(Context, *contours, InstanceConfig.maxVertsPerPoly, *pmesh); - - rcPolyMeshDetail* dmesh = rcAllocPolyMeshDetail(); - rcBuildPolyMeshDetail(Context, *pmesh, *chf, InstanceConfig.detailSampleDist, InstanceConfig.detailSampleMaxError, *dmesh); - - // Set flags according to area types (e.g. Swim for Water) - for (int i = 0; i < pmesh->npolys; i++) - { - if (pmesh->areas[i] == Constants::POLY_AREA_ROAD || pmesh->areas[i] == Constants::POLY_AREA_TERRAIN) - pmesh->flags[i] = Constants::POLY_FLAG_WALK; - else if (pmesh->areas[i] == Constants::POLY_AREA_WATER) - pmesh->flags[i] = Constants::POLY_FLAG_SWIM; - } - - dtNavMeshCreateParams params; - memset(¶ms, 0, sizeof(params)); - // PolyMesh data - params.verts = pmesh->verts; - params.vertCount = pmesh->nverts; - params.polys = pmesh->polys; - params.polyAreas = pmesh->areas; - params.polyFlags = pmesh->flags; - params.polyCount = pmesh->npolys; - params.nvp = pmesh->nvp; - // PolyMeshDetail data - params.detailMeshes = dmesh->meshes; - params.detailVerts = dmesh->verts; - params.detailVertsCount = dmesh->nverts; - params.detailTris = dmesh->tris; - params.detailTriCount = dmesh->ntris; - rcVcopy(params.bmin, pmesh->bmin); - rcVcopy(params.bmax, pmesh->bmax); - // General settings - params.ch = InstanceConfig.ch; - params.cs = InstanceConfig.cs; - params.walkableClimb = InstanceConfig.walkableClimb * InstanceConfig.ch; - params.walkableHeight = InstanceConfig.walkableHeight * InstanceConfig.ch; - params.walkableRadius = InstanceConfig.walkableRadius * InstanceConfig.cs; - params.tileX = X; - params.tileY = Y; - params.tileLayer = 0; - params.buildBvTree = true; - - rcVcopy(params.bmax, bmax); - rcVcopy(params.bmin, bmin); - - // Offmesh-connection settings - params.offMeshConCount = 0; // none for now - - rcFreeHeightField(hf); - rcFreeCompactHeightfield(chf); - rcFreeContourSet(contours); - delete vertices; - delete triangles; - delete areas; - delete bmin; - delete bmax; - - if (!params.polyCount || !params.polys || Constants::TilesPerMap * Constants::TilesPerMap == params.polyCount) - { - // we have flat tiles with no actual geometry - don't build those, its useless - // keep in mind that we do output those into debug info - // drop tiles with only exact count - some tiles may have geometry while having less tiles - printf("No polygons to build on tile, skipping.\n"); - rcFreePolyMesh(pmesh); - rcFreePolyMeshDetail(dmesh); - return NULL; - } - - int navDataSize; - uint8* navData; - printf("Creating the navmesh with %i vertices, %i polys, %i triangles!\n", params.vertCount, params.polyCount, params.detailTriCount); - bool result = dtCreateNavMeshData(¶ms, &navData, &navDataSize); - - rcFreePolyMesh(pmesh); - rcFreePolyMeshDetail(dmesh); - - if (result) - { - printf("NavMesh created, size %i!\n", navDataSize); - DataSize = navDataSize; - return navData; - } - - return NULL; -} - -uint8* TileBuilder::BuildTiled(dtNavMeshParams& navMeshParams) -{ - _Geometry = new Geometry(); - _Geometry->Transform = true; - ADT* adt = new ADT(Utils::GetAdtPath(World, X, Y), X, Y); - adt->Read(); - _Geometry->AddAdt(adt); - delete adt; - - if (_Geometry->Vertices.empty() && _Geometry->Triangles.empty()) - return NULL; - - float* bmin = NULL, *bmax = NULL; - CalculateTileBounds(bmin, bmax, navMeshParams); - _Geometry->CalculateMinMaxHeight(bmin[1], bmax[1]); - - // again, we load everything - wasteful but who cares - for (int ty = Y - 1; ty <= Y + 1; ty++) - { - for (int tx = X - 1; tx <= X + 1; tx++) - { - // don't load main tile again - if (tx == X && ty == Y) - continue; - - ADT* _adt = new ADT(Utils::GetAdtPath(World, tx, ty), tx, ty); - // If this condition is met, it means that this WDT does not contain the ADT - if (!_adt->Data->Stream) - { - delete _adt; - continue; - } - _adt->Read(); - _Geometry->AddAdt(_adt); - delete _adt; - } - } - - OutputDebugVertices(); - - uint32 numVerts = _Geometry->Vertices.size(); - uint32 numTris = _Geometry->Triangles.size(); - float* vertices; - int* triangles; - uint8* areas; - _Geometry->GetRawData(vertices, triangles, areas); - _Geometry->Vertices.clear(); - _Geometry->Triangles.clear(); - - // add border - bmin[0] -= Config.borderSize * Config.cs; - bmin[2] -= Config.borderSize * Config.cs; - bmax[0] += Config.borderSize * Config.cs; - bmax[2] += Config.borderSize * Config.cs; - - rcHeightfield* hf = rcAllocHeightfield(); - int width = Config.tileSize + (Config.borderSize * 2); - rcCreateHeightfield(Context, *hf, width, width, bmin, bmax, Config.cs, Config.ch); - - rcClearUnwalkableTriangles(Context, Config.walkableSlopeAngle, vertices, numVerts, triangles, numTris, areas); - rcRasterizeTriangles(Context, vertices, numVerts, triangles, areas, numTris, *hf, Config.walkableClimb); - - rcFilterLowHangingWalkableObstacles(Context, Config.walkableClimb, *hf); - rcFilterLedgeSpans(Context, Config.walkableHeight, Config.walkableClimb, *hf); - rcFilterWalkableLowHeightSpans(Context, Config.walkableHeight, *hf); - - rcCompactHeightfield* chf = rcAllocCompactHeightfield(); - rcBuildCompactHeightfield(Context, Config.walkableHeight, Config.walkableClimb, *hf, *chf); - - rcErodeWalkableArea(Context, Config.walkableRadius, *chf); - rcBuildDistanceField(Context, *chf); - rcBuildRegions(Context, *chf, Config.borderSize, Config.minRegionArea, Config.mergeRegionArea); - - rcContourSet* contours = rcAllocContourSet(); - rcBuildContours(Context, *chf, Config.maxSimplificationError, Config.maxEdgeLen, *contours); - - rcPolyMesh* pmesh = rcAllocPolyMesh(); - rcBuildPolyMesh(Context, *contours, Config.maxVertsPerPoly, *pmesh); - - rcPolyMeshDetail* dmesh = rcAllocPolyMeshDetail(); - rcBuildPolyMeshDetail(Context, *pmesh, *chf, Config.detailSampleDist, Config.detailSampleMaxError, *dmesh); - - // Set flags according to area types (e.g. Swim for Water) - for (int i = 0; i < pmesh->npolys; i++) - { - if (pmesh->areas[i] == Constants::POLY_AREA_ROAD || pmesh->areas[i] == Constants::POLY_AREA_TERRAIN) - pmesh->flags[i] = Constants::POLY_FLAG_WALK; - else if (pmesh->areas[i] == Constants::POLY_AREA_WATER) - pmesh->flags[i] = Constants::POLY_FLAG_SWIM; - } - - dtNavMeshCreateParams params; - memset(¶ms, 0, sizeof(params)); - // PolyMesh data - params.verts = pmesh->verts; - params.vertCount = pmesh->nverts; - params.polys = pmesh->polys; - params.polyAreas = pmesh->areas; - params.polyFlags = pmesh->flags; - params.polyCount = pmesh->npolys; - params.nvp = pmesh->nvp; - // PolyMeshDetail data - params.detailMeshes = dmesh->meshes; - params.detailVerts = dmesh->verts; - params.detailVertsCount = dmesh->nverts; - params.detailTris = dmesh->tris; - params.detailTriCount = dmesh->ntris; - // General settings - params.ch = Config.ch; - params.cs = Config.cs; - params.walkableClimb = Config.walkableClimb * Config.ch; - params.walkableHeight = Config.walkableHeight * Config.ch; - params.walkableRadius = Config.walkableRadius * Config.cs; - params.tileX = X; - params.tileY = Y; - params.tileLayer = 0; - params.buildBvTree = true; - - // Recalculate the bounds with the added geometry - float* bmin2 = NULL, *bmax2 = NULL; - CalculateTileBounds(bmin2, bmax2, navMeshParams); - bmin2[1] = bmin[1]; - bmax2[1] = bmax[1]; - - rcVcopy(params.bmax, bmax2); - rcVcopy(params.bmin, bmin2); - - // Offmesh-connection settings - params.offMeshConCount = 0; // none for now - - rcFreeHeightField(hf); - rcFreeCompactHeightfield(chf); - rcFreeContourSet(contours); - delete vertices; - delete triangles; - delete areas; - delete bmin; - delete bmax; - - if (!params.polyCount || !params.polys || Constants::TilesPerMap * Constants::TilesPerMap == params.polyCount) - { - // we have flat tiles with no actual geometry - don't build those, its useless - // keep in mind that we do output those into debug info - // drop tiles with only exact count - some tiles may have geometry while having less tiles - printf("[%02i, %02i] No polygons to build on tile, skipping.\n", X, Y); - rcFreePolyMesh(pmesh); - rcFreePolyMeshDetail(dmesh); - return NULL; - } - - int navDataSize; - uint8* navData; - printf("[%02i, %02i] Creating the navmesh with %i vertices, %i polys, %i triangles!\n", X, Y, params.vertCount, params.polyCount, params.detailTriCount); - bool result = dtCreateNavMeshData(¶ms, &navData, &navDataSize); - - rcFreePolyMesh(pmesh); - rcFreePolyMeshDetail(dmesh); - - if (result) - { - printf("[%02i, %02i] NavMesh created, size %i!\n", X, Y, navDataSize); - DataSize = navDataSize; - return navData; - } - - return NULL; -} - -void TileBuilder::OutputDebugVertices() -{ - if (Constants::Debug) - { - char buff[100]; - sprintf(buff, "mmaps/%s_%02u%02u.obj", World.c_str(), Y, X); - FILE* debug = fopen(buff, "wb"); - for (uint32 i = 0; i < _Geometry->Vertices.size(); ++i) - { - const Vector3& vector = _Geometry->Vertices[i]; - fprintf(debug, "v %f %f %f\n", vector.x, vector.y, vector.z); - } - for (uint32 i = 0; i < _Geometry->Triangles.size(); ++i) - { - const Triangle& triangle = _Geometry->Triangles[i]; - fprintf(debug, "f %u %u %u\n", triangle.V0 + 1, triangle.V1 + 1, triangle.V2 + 1); - } - fclose(debug); - } -} - -TileBuilder::~TileBuilder() -{ - delete Context; - delete _Geometry; -} diff --git a/src/tools/mesh_extractor/TileBuilder.h b/src/tools/mesh_extractor/TileBuilder.h deleted file mode 100644 index 815f9597d4..0000000000 --- a/src/tools/mesh_extractor/TileBuilder.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef TILE_BUILD_H -#define TILE_BUILD_H -#include -#include "Recast.h" - -#include "Geometry.h" -#include "WorldModelRoot.h" - -class ContinentBuilder; -class WDT; - -class TileBuilder -{ -public: - TileBuilder(ContinentBuilder* _cBuilder, std::string world, int x, int y, uint32 mapId); - ~TileBuilder(); - - void CalculateTileBounds(float*& bmin, float*& bmax, dtNavMeshParams& navMeshParams); - uint8* BuildTiled(dtNavMeshParams& navMeshParams); - uint8* BuildInstance(dtNavMeshParams& navMeshParams); - void AddGeometry(WorldModelRoot* root, const WorldModelDefinition& def); - void OutputDebugVertices(); - std::string World; - int X; - int Y; - int MapId; - rcConfig Config; - rcConfig InstanceConfig; - rcContext* Context; - Geometry* _Geometry; - uint32 DataSize; - ContinentBuilder* cBuilder; -}; -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/Utils.cpp b/src/tools/mesh_extractor/Utils.cpp deleted file mode 100644 index 3dcdd6598e..0000000000 --- a/src/tools/mesh_extractor/Utils.cpp +++ /dev/null @@ -1,564 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "Utils.h" -#include "WorldModelHandler.h" -#include "Constants.h" -#include -#include "G3D/Matrix4.h" -#include "G3D/Quat.h" - -#ifdef _WIN32 - #include "direct.h" -#else - #include - #include -#endif - -const float Constants::TileSize = 533.0f + (1/3.0f); -const float Constants::MaxXY = 32.0f * Constants::TileSize; -const float Constants::ChunkSize = Constants::TileSize / 16.0f; -const float Constants::UnitSize = Constants::ChunkSize / 8.0f; -const float Constants::Origin[] = { -Constants::MaxXY, 0.0f, -Constants::MaxXY }; -const float Constants::PI = 3.1415926f; -const float Constants::MaxStandableHeight = 1.5f; -const char* Constants::VMAPMagic = "VMAP041"; -bool Constants::ToWoWCoords = false; -bool Constants::Debug = false; -const float Constants::BaseUnitDim = 0.533333f; -const int Constants::VertexPerMap = (Constants::TileSize / Constants::BaseUnitDim) + 0.5f; -const int Constants::VertexPerTile = 40; -const int Constants::TilesPerMap = Constants::VertexPerMap / Constants::VertexPerTile; - -void Utils::CreateDir( const std::string& Path ) -{ -#ifdef _WIN32 - _mkdir( Path.c_str()); -#else - mkdir( Path.c_str(), 0777 ); -#endif -} - -void Utils::Reverse(char word[]) -{ - int len = strlen(word); - for (int i = 0;i < len / 2; i++) - { - word[i] ^= word[len-i-1]; - word[len-i-1] ^= word[i]; - word[i] ^= word[len-i-1]; - } -} - -std::string Utils::ReadString( FILE* file ) -{ - std::string ret; - while (true) - { - char b; - if (fread(&b, sizeof(char), 1, file) != 1 || b == 0) - break; - ret.push_back(b); - } - return ret; -} - -uint32 Utils::Size( FILE* file ) -{ - // store the old position - uint32 offset = ftell(file); - // Get file size - fseek(file, 0, SEEK_END); - uint32 size = ftell(file); - // reset back to the old position - fseek(file, offset, SEEK_SET); - return size; -} - -Vector3 Utils::ToRecast(const Vector3& val ) -{ - return Vector3(-val.y, val.z, -val.x); -} - -std::string Utils::GetAdtPath(const std::string& world, int x, int y ) -{ - return "World\\Maps\\" + world + "\\" + world + "_" + Utils::ToString(x) + "_" + Utils::ToString(y) + ".adt"; -} - -std::string Utils::FixModelPath(const std::string& path ) -{ - return Utils::GetPathBase(path) + ".M2"; -} - -Vector3 Utils::TransformDoodadVertex(const IDefinition& def, Vector3& vec, bool translate) -{ - // Sources of information: - /// http://www.pxr.dk/wowdev/wiki/index.php?title=ADT/v18&oldid=3715 - - // This function applies to both external doodads and WMOs - - // Rotate our Doodad vertex - G3D::Matrix4 rot = G3D::Matrix3::fromEulerAnglesXYZ(Utils::ToRadians(def.Rotation.z), Utils::ToRadians(-def.Rotation.x), Utils::ToRadians(def.Rotation.y + 180)); - Vector3 ret = Utils::VectorTransform(vec, rot); - - // And finally scale and translate it to our origin - ret = ret * def.Scale(); - if (translate) - ret = ret + Vector3(Constants::MaxXY - def.Position.z, Constants::MaxXY - def.Position.x, def.Position.y); - return ret; -} - -Vector3 Utils::TransformWmoDoodad(const DoodadInstance& inst, const WorldModelDefinition& root, Vector3& vec, bool translate ) -{ - G3D::Quat quat = G3D::Quat(-inst.QuatY, inst.QuatZ, -inst.QuatX, inst.QuatW); - - Vector3 ret = Utils::VectorTransform(vec, G3D::Matrix4(quat.toRotationMatrix())); - ret = ret * (inst.Scale / 1024.0f); - if (translate) - ret = ret + Vector3(Constants::MaxXY - inst.Position.z, Constants::MaxXY - inst.Position.x, inst.Position.y); - return ret; -} - -float Utils::ToRadians( float degrees ) -{ - return Constants::PI * degrees / 180.0f; -} - -Vector3 Utils::VectorTransform(const Vector3& vec, const G3D::Matrix4& matrix, bool normal ) -{ - G3D::Vector3 ret(vec.x, vec.y, vec.z); - ret = matrix.homoMul(ret, normal ? 0 : 1); - return Vector3(ret.x, ret.y, ret.z); -} - -std::string Utils::GetPathBase(const std::string& path ) -{ - size_t lastIndex = path.find_last_of("."); - if (lastIndex != std::string::npos) - return path.substr(0, lastIndex); - return path; -} - -Vector3 Vector3::Read( FILE* file ) -{ - Vector3 ret; - if (fread(&ret, sizeof(Vector3), 1, file) != 1) - printf("Vector3::Read: Failed to read some data expected 1, read 0\n"); - return ret; -} - -Vector3 Utils::GetLiquidVert(const IDefinition& def, Vector3 basePosition, float height, int x, int y, bool translate) -{ - if (Utils::Distance(height, 0.0f) > 0.5f) - basePosition.z = 0.0f; - return Utils::TransformDoodadVertex(def, basePosition + Vector3(x * Constants::UnitSize, y * Constants::UnitSize, height), translate); -} - -float Utils::Distance( float x, float y ) -{ - return sqrt(x*x + y*y); -} - -std::string Utils::Replace( std::string str, const std::string& oldStr, const std::string& newStr ) -{ - size_t pos = 0; - while((pos = str.find(oldStr, pos)) != std::string::npos) - { - str.replace(pos, oldStr.length(), newStr); - pos += newStr.length(); - } - return str; -} - -void Utils::SaveToDisk( FILE* stream, const std::string& path ) -{ - FILE* disk = fopen(path.c_str(), "wb"); - if (!disk) - { - printf("SaveToDisk: Could not save file %s to disk, please verify that you have write permissions on that directory\n", path.c_str()); - fclose(stream); - return; - } - - uint32 size = Utils::Size(stream); - uint8* data = new uint8[size]; - // Read the data to an array - size_t read = fread(data, size, 1, stream); - if (read != 1) - { - printf("SaveToDisk: Error reading from Stream while trying to save file %s to disk.\n", path.c_str()); - fclose(disk); - fclose(stream); - return; - } - - // And write it in the file - size_t wrote = fwrite(data, size, 1, disk); - if (wrote != 1) - { - printf("SaveToDisk: Error writing to the file while trying to save %s to disk.\n", path.c_str()); - fclose(stream); - fclose(disk); - return; - } - - // Close the filestream - fclose(disk); - fclose(stream); - - // Free the used memory - delete[] data; -} - -Vector3 Utils::ToWoWCoords(const Vector3& vec ) -{ - return Vector3(-vec.z, -vec.x, vec.y); -} - -std::string Utils::GetExtension( std::string path ) -{ - std::string::size_type idx = path.rfind('.'); - std::string extension = ""; - - if(idx != std::string::npos) - extension = path.substr(idx+1); - return extension; -} - -void MapChunkHeader::Read(FILE* stream) -{ - int count = 0; - - count += fread(&Flags, sizeof(uint32), 1, stream); - count += fread(&IndexX, sizeof(uint32), 1, stream); - count += fread(&IndexY, sizeof(uint32), 1, stream); - count += fread(&Layers, sizeof(uint32), 1, stream); - count += fread(&DoodadRefs, sizeof(uint32), 1, stream); - count += fread(&OffsetMCVT, sizeof(uint32), 1, stream); - count += fread(&OffsetMCNR, sizeof(uint32), 1, stream); - count += fread(&OffsetMCLY, sizeof(uint32), 1, stream); - count += fread(&OffsetMCRF, sizeof(uint32), 1, stream); - count += fread(&OffsetMCAL, sizeof(uint32), 1, stream); - count += fread(&SizeMCAL, sizeof(uint32), 1, stream); - count += fread(&OffsetMCSH, sizeof(uint32), 1, stream); - count += fread(&SizeMCSH, sizeof(uint32), 1, stream); - count += fread(&AreaId, sizeof(uint32), 1, stream); - count += fread(&MapObjectRefs, sizeof(uint32), 1, stream); - count += fread(&Holes, sizeof(uint32), 1, stream); - LowQualityTextureMap = new uint32[4]; - count += fread(LowQualityTextureMap, sizeof(uint32), 4, stream); - count += fread(&PredTex, sizeof(uint32), 1, stream); - count += fread(&NumberEffectDoodad, sizeof(uint32), 1, stream); - count += fread(&OffsetMCSE, sizeof(uint32), 1, stream); - count += fread(&SoundEmitters, sizeof(uint32), 1, stream); - count += fread(&OffsetMCLQ, sizeof(uint32), 1, stream); - count += fread(&SizeMCLQ, sizeof(uint32), 1, stream); - Position = Vector3::Read(stream); - count += fread(&OffsetMCCV, sizeof(uint32), 1, stream); - - if (count != 27) - printf("MapChunkHeader::Read: Failed to read some data expected 27, read %d\n", count); -} - -void MHDR::Read(FILE* stream) -{ - int count = 0; - - count += fread(&Flags, sizeof(uint32), 1, stream); - count += fread(&OffsetMCIN, sizeof(uint32), 1, stream); - count += fread(&OffsetMTEX, sizeof(uint32), 1, stream); - count += fread(&OffsetMMDX, sizeof(uint32), 1, stream); - count += fread(&OffsetMMID, sizeof(uint32), 1, stream); - count += fread(&OffsetMWMO, sizeof(uint32), 1, stream); - count += fread(&OffsetMWID, sizeof(uint32), 1, stream); - count += fread(&OffsetMDDF, sizeof(uint32), 1, stream); - count += fread(&OffsetMODF, sizeof(uint32), 1, stream); - count += fread(&OffsetMFBO, sizeof(uint32), 1, stream); - count += fread(&OffsetMH2O, sizeof(uint32), 1, stream); - count += fread(&OffsetMTFX, sizeof(uint32), 1, stream); - - if (count != 12) - printf("MHDR::Read: Failed to read some data expected 12, read %d\n", count); -} - -void ModelHeader::Read(FILE* stream) -{ - int count = 0; - - count += fread(&Magic, sizeof(char), 4, stream); - Magic[4] = '\0'; // null-terminate it. - count += fread(&Version, sizeof(uint32), 1, stream); - count += fread(&LengthModelName, sizeof(uint32), 1, stream); - count += fread(&OffsetName, sizeof(uint32), 1, stream); - count += fread(&ModelFlags, sizeof(uint32), 1, stream); - count += fread(&CountGlobalSequences, sizeof(uint32), 1, stream); - count += fread(&OffsetGlobalSequences, sizeof(uint32), 1, stream); - count += fread(&CountAnimations, sizeof(uint32), 1, stream); - count += fread(&OffsetAnimations, sizeof(uint32), 1, stream); - count += fread(&CountAnimationLookup, sizeof(uint32), 1, stream); - count += fread(&OffsetAnimationLookup, sizeof(uint32), 1, stream); - count += fread(&CountBones, sizeof(uint32), 1, stream); - count += fread(&OffsetBones, sizeof(uint32), 1, stream); - count += fread(&CountKeyBoneLookup, sizeof(uint32), 1, stream); - count += fread(&OffsetKeyBoneLookup, sizeof(uint32), 1, stream); - count += fread(&CountVertices, sizeof(uint32), 1, stream); - count += fread(&OffsetVertices, sizeof(uint32), 1, stream); - count += fread(&CountViews, sizeof(uint32), 1, stream); - count += fread(&CountColors, sizeof(uint32), 1, stream); - count += fread(&OffsetColors, sizeof(uint32), 1, stream); - count += fread(&CountTextures, sizeof(uint32), 1, stream); - count += fread(&OffsetTextures, sizeof(uint32), 1, stream); - count += fread(&CountTransparency, sizeof(uint32), 1, stream); - count += fread(&OffsetTransparency, sizeof(uint32), 1, stream); - count += fread(&CountUvAnimation, sizeof(uint32), 1, stream); - count += fread(&OffsetUvAnimation, sizeof(uint32), 1, stream); - count += fread(&CountTexReplace, sizeof(uint32), 1, stream); - count += fread(&OffsetTexReplace, sizeof(uint32), 1, stream); - count += fread(&CountRenderFlags, sizeof(uint32), 1, stream); - count += fread(&OffsetRenderFlags, sizeof(uint32), 1, stream); - count += fread(&CountBoneLookup, sizeof(uint32), 1, stream); - count += fread(&OffsetBoneLookup, sizeof(uint32), 1, stream); - count += fread(&CountTexLookup, sizeof(uint32), 1, stream); - count += fread(&OffsetTexLookup, sizeof(uint32), 1, stream); - count += fread(&CountTexUnits, sizeof(uint32), 1, stream); - count += fread(&OffsetTexUnits, sizeof(uint32), 1, stream); - count += fread(&CountTransLookup, sizeof(uint32), 1, stream); - count += fread(&OffsetTransLookup, sizeof(uint32), 1, stream); - count += fread(&CountUvAnimLookup, sizeof(uint32), 1, stream); - count += fread(&OffsetUvAnimLookup, sizeof(uint32), 1, stream); - VertexBox[0] = Vector3::Read(stream); - VertexBox[1] = Vector3::Read(stream); - count += fread(&VertexRadius, sizeof(float), 1, stream); - BoundingBox[0] = Vector3::Read(stream); - BoundingBox[1] = Vector3::Read(stream); - count += fread(&BoundingRadius, sizeof(float), 1, stream); - count += fread(&CountBoundingTriangles, sizeof(uint32), 1, stream); - count += fread(&OffsetBoundingTriangles, sizeof(uint32), 1, stream); - count += fread(&CountBoundingVertices, sizeof(uint32), 1, stream); - count += fread(&OffsetBoundingVertices, sizeof(uint32), 1, stream); - count += fread(&CountBoundingNormals, sizeof(uint32), 1, stream); - count += fread(&OffsetBoundingNormals, sizeof(uint32), 1, stream); - - if (count != 51) - printf("ModelHeader::Read: Failed to read some data expected 51, read %d\n", count); - -} - -WorldModelHeader WorldModelHeader::Read(FILE* stream) -{ - WorldModelHeader ret; - int count = 0; - - count += fread(&ret.CountMaterials, sizeof(uint32), 1, stream); - count += fread(&ret.CountGroups, sizeof(uint32), 1, stream); - count += fread(&ret.CountPortals, sizeof(uint32), 1, stream); - count += fread(&ret.CountLights, sizeof(uint32), 1, stream); - count += fread(&ret.CountModels, sizeof(uint32), 1, stream); - count += fread(&ret.CountDoodads, sizeof(uint32), 1, stream); - count += fread(&ret.CountSets, sizeof(uint32), 1, stream); - count += fread(&ret.AmbientColorUnk, sizeof(uint32), 1, stream); - count += fread(&ret.WmoId, sizeof(uint32), 1, stream); - ret.BoundingBox[0] = Vector3::Read(stream); - ret.BoundingBox[1] = Vector3::Read(stream); - count += fread(&ret.LiquidTypeRelated, sizeof(uint32), 1, stream); - - if (count != 10) - printf("WorldModelHeader::Read: Failed to read some data expected 10, read %d\n", count); - - return ret; -} - -DoodadInstance DoodadInstance::Read(FILE* stream) -{ - DoodadInstance ret; - int count = 0; - - count += fread(&ret.FileOffset, sizeof(uint32), 1, stream); - ret.Position = Vector3::Read(stream); - count += fread(&ret.QuatW, sizeof(float), 1, stream); - count += fread(&ret.QuatX, sizeof(float), 1, stream); - count += fread(&ret.QuatY, sizeof(float), 1, stream); - count += fread(&ret.QuatZ, sizeof(float), 1, stream); - count += fread(&ret.Scale, sizeof(float), 1, stream); - count += fread(&ret.LightColor, sizeof(uint32), 1, stream); - - if (count != 7) - printf("DoodadInstance::Read: Failed to read some data expected 7, read %d\n", count); - - return ret; -} - -DoodadSet DoodadSet::Read(FILE* stream) -{ - DoodadSet ret; - char name[21]; - int count = 0; - - count += fread(&name, sizeof(char), 20, stream); - name[20] = '\0'; - ret.Name = name; - count += fread(&ret.FirstInstanceIndex, sizeof(uint32), 1, stream); - count += fread(&ret.CountInstances, sizeof(uint32), 1, stream); - count += fread(&ret.UnknownZero, sizeof(uint32), 1, stream); - - if (count != 23) - printf("DoodadSet::Read: Failed to read some data expected 23, read %d\n", count); - - return ret; -} - -LiquidHeader LiquidHeader::Read(FILE* stream) -{ - LiquidHeader ret; - int count = 0; - count += fread(&ret.CountXVertices, sizeof(uint32), 1, stream); - count += fread(&ret.CountYVertices, sizeof(uint32), 1, stream); - count += fread(&ret.Width, sizeof(uint32), 1, stream); - count += fread(&ret.Height, sizeof(uint32), 1, stream); - ret.BaseLocation = Vector3::Read(stream); - count += fread(&ret.MaterialId, sizeof(uint16), 1, stream); - - if (count != 5) - printf("LiquidHeader::Read: Failed to read some data expected 5, read %d\n", count); - - return ret; -} - -LiquidData LiquidData::Read(FILE* stream, LiquidHeader& header) -{ - LiquidData ret; - ret.HeightMap = new float*[header.CountXVertices]; - for (uint32 i = 0; i < header.CountXVertices; ++i) - ret.HeightMap[i] = new float[header.CountYVertices]; - - ret.RenderFlags = new uint8*[header.Width]; - for (uint32 i = 0; i < header.Width; ++i) - ret.RenderFlags[i] = new uint8[header.Height]; - - for (uint32 y = 0; y < header.CountYVertices; y++) - { - for (uint32 x = 0; x < header.CountXVertices; x++) - { - uint32 discard; - float tmp; - if (fread(&discard, sizeof(uint32), 1, stream) == 1 && - fread(&tmp, sizeof(float), 1, stream) == 1) - { - ret.HeightMap[x][y] = tmp; - } - } - } - - for (uint32 y = 0; y < header.Height; y++) - { - for (uint32 x = 0; x < header.Width; x++) - { - uint8 tmp = 0; - if (fread(&tmp, sizeof(uint8), 1, stream) == 1) - ret.RenderFlags[x][y] = tmp; - } - } - - return ret; -} - -H2ORenderMask H2ORenderMask::Read(FILE* stream) -{ - H2ORenderMask ret; - int32 count; - if ((count = fread(&ret.Mask, sizeof(uint8), 8, stream)) != 8) - printf("H2OHeader::Read: Failed to read some data expected 8, read %d\n", count); - return ret; -} - -bool MCNKLiquidData::IsWater(int x, int y, float height) -{ - if (!Heights) - return false; - if (!Mask.ShouldRender(x, y)) - return false; - float diff = Heights[x][y] - height; - if (diff > Constants::MaxStandableHeight) - return true; - return false; -} - -H2OHeader H2OHeader::Read(FILE* stream) -{ - H2OHeader ret; - int count = 0; - count += fread(&ret.OffsetInformation, sizeof(uint32), 1, stream); - count += fread(&ret.LayerCount, sizeof(uint32), 1, stream); - count += fread(&ret.OffsetRender, sizeof(uint32), 1, stream); - - if (count != 3) - printf("H2OHeader::Read: Failed to read some data expected 3, read %d\n", count); - - return ret; -} - -H2OInformation H2OInformation::Read(FILE* stream) -{ - H2OInformation ret; - int count = 0; - count += fread(&ret.LiquidType, sizeof(uint16), 1, stream); - count += fread(&ret.Flags, sizeof(uint16), 1, stream); - count += fread(&ret.HeightLevel1, sizeof(float), 1, stream); - count += fread(&ret.HeightLevel2, sizeof(float), 1, stream); - count += fread(&ret.OffsetX, sizeof(uint8), 1, stream); - count += fread(&ret.OffsetY, sizeof(uint8), 1, stream); - count += fread(&ret.Width, sizeof(uint8), 1, stream); - count += fread(&ret.Height, sizeof(uint8), 1, stream); - count += fread(&ret.OffsetMask2, sizeof(uint32), 1, stream); - count += fread(&ret.OffsetHeightmap, sizeof(uint32), 1, stream); - - if (count != 10) - printf("H2OInformation::Read: Failed to read some data expected 10, read %d\n", count); - - return ret; -} - -char* Utils::GetPlainName(const char* FileName) -{ - char* temp; - - if((temp = (char*)strrchr(FileName, '\\')) != NULL) - FileName = temp + 1; - return (char*)FileName; -} - -WMOGroupHeader WMOGroupHeader::Read( FILE* stream ) -{ - WMOGroupHeader ret; - int count = 0; - count += fread(&ret.OffsetGroupName, sizeof(uint32), 1, stream); - count += fread(&ret.OffsetDescriptiveName, sizeof(uint32), 1, stream); - count += fread(&ret.Flags, sizeof(uint32), 1, stream); - ret.BoundingBox[0] = Vector3::Read(stream); - ret.BoundingBox[1] = Vector3::Read(stream); - count += fread(&ret.OffsetPortals, sizeof(uint32), 1, stream); - count += fread(&ret.CountPortals, sizeof(uint32), 1, stream); - count += fread(&ret.CountBatches, sizeof(uint16), 4, stream); - count += fread(&ret.Fogs, sizeof(uint8), 4, stream); - count += fread(&ret.LiquidTypeRelated, sizeof(uint32), 1, stream); - count += fread(&ret.WmoId, sizeof(uint32), 1, stream); - - if (count != 15) - printf("WMOGroupHeader::Read: Failed to read some data expected 15, read %d\n", count); - - return ret; -} diff --git a/src/tools/mesh_extractor/Utils.h b/src/tools/mesh_extractor/Utils.h deleted file mode 100644 index fcdffe0f8f..0000000000 --- a/src/tools/mesh_extractor/Utils.h +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef UTILS_H -#define UTILS_H -#include -#include -#include - -#include "G3D/Matrix4.h" -#include "DetourNavMesh.h" - -#include "Define.h" -#include "Constants.h" - -#include - -struct WorldModelDefinition; -class DoodadDefinition; -class DoodadInstance; - -#define ASSERT(assertion) { if (!(assertion)) { ACE_Stack_Trace st; fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); *((volatile int*)NULL) = 0; } } - -struct Vector3 -{ - Vector3() {} - Vector3(float X, float Y, float Z) : x(X), y(Y), z(Z) {} - float x; - float y; - float z; - - Vector3 operator +(Vector3 const& other) const - { - return Vector3(x + other.x, y + other.y, z + other.z); - } - - Vector3 operator -(Vector3 const& other) const - { - return Vector3(x - other.x, y - other.y, z - other.z); - } - - template - Vector3 operator *(T s) const - { - return Vector3(x * s, y * s, z * s); - } - - static Vector3 Read(FILE* file); -}; - -struct TilePos -{ - TilePos(int x, int y) : X(x), Y(y) {} - int X; - int Y; -}; - -template -struct Triangle -{ - Triangle() {} - Triangle(Constants::TriangleType type, T v0, T v1, T v2) : V0(v0), V1(v1), V2(v2), Type(type) {} - T V0; - T V1; - T V2; - Constants::TriangleType Type; -}; - -class MapChunkHeader -{ -public: - MapChunkHeader() {} - uint32 Flags; - uint32 IndexX; - uint32 IndexY; - uint32 Layers; - uint32 DoodadRefs; - uint32 OffsetMCVT; - uint32 OffsetMCNR; - uint32 OffsetMCLY; - uint32 OffsetMCRF; - uint32 OffsetMCAL; - uint32 SizeMCAL; - uint32 OffsetMCSH; - uint32 SizeMCSH; - uint32 AreaId; - uint32 MapObjectRefs; - uint32 Holes; - uint32* LowQualityTextureMap; - uint32 PredTex; - uint32 NumberEffectDoodad; - uint32 OffsetMCSE; - uint32 SoundEmitters; - uint32 OffsetMCLQ; - uint32 SizeMCLQ; - Vector3 Position; - uint32 OffsetMCCV; - - void Read(FILE* stream); -}; - -class MHDR -{ -public: - MHDR() {} - uint32 Flags; - uint32 OffsetMCIN; - uint32 OffsetMTEX; - uint32 OffsetMMDX; - uint32 OffsetMMID; - uint32 OffsetMWMO; - uint32 OffsetMWID; - uint32 OffsetMDDF; - uint32 OffsetMODF; - uint32 OffsetMFBO; - uint32 OffsetMH2O; - uint32 OffsetMTFX; - - void Read(FILE* stream); -}; - -class ModelHeader -{ -public: - char Magic[5]; - uint32 Version; - uint32 LengthModelName; - uint32 OffsetName; - uint32 ModelFlags; - uint32 CountGlobalSequences; - uint32 OffsetGlobalSequences; - uint32 CountAnimations; - uint32 OffsetAnimations; - uint32 CountAnimationLookup; - uint32 OffsetAnimationLookup; - uint32 CountBones; - uint32 OffsetBones; - uint32 CountKeyBoneLookup; - uint32 OffsetKeyBoneLookup; - uint32 CountVertices; - uint32 OffsetVertices; - uint32 CountViews; - uint32 CountColors; - uint32 OffsetColors; - uint32 CountTextures; - uint32 OffsetTextures; - uint32 CountTransparency; - uint32 OffsetTransparency; - uint32 CountUvAnimation; - uint32 OffsetUvAnimation; - uint32 CountTexReplace; - uint32 OffsetTexReplace; - uint32 CountRenderFlags; - uint32 OffsetRenderFlags; - uint32 CountBoneLookup; - uint32 OffsetBoneLookup; - uint32 CountTexLookup; - uint32 OffsetTexLookup; - uint32 CountTexUnits; - uint32 OffsetTexUnits; - uint32 CountTransLookup; - uint32 OffsetTransLookup; - uint32 CountUvAnimLookup; - uint32 OffsetUvAnimLookup; - Vector3 VertexBox[2]; - float VertexRadius; - Vector3 BoundingBox[2]; - float BoundingRadius; - uint32 CountBoundingTriangles; - uint32 OffsetBoundingTriangles; - uint32 CountBoundingVertices; - uint32 OffsetBoundingVertices; - uint32 CountBoundingNormals; - uint32 OffsetBoundingNormals; - - void Read(FILE* stream); -}; - -class WorldModelHeader -{ -public: - WorldModelHeader() {} - uint32 CountMaterials; - uint32 CountGroups; - uint32 CountPortals; - uint32 CountLights; - uint32 CountModels; - uint32 CountDoodads; - uint32 CountSets; - uint32 AmbientColorUnk; - uint32 WmoId; - Vector3 BoundingBox[2]; - uint32 LiquidTypeRelated; - - static WorldModelHeader Read(FILE* stream); -}; - -class DoodadInstance -{ -public: - DoodadInstance() {} - uint32 FileOffset; - std::string File; - Vector3 Position; - float QuatW; - float QuatX; - float QuatY; - float QuatZ; - float Scale; - uint32 LightColor; - - static DoodadInstance Read(FILE* stream); -}; - -class DoodadSet -{ -public: - DoodadSet() {} - std::string Name; - uint32 FirstInstanceIndex; - uint32 CountInstances; - uint32 UnknownZero; - - static DoodadSet Read(FILE* stream); -}; - -class LiquidHeader -{ -public: - LiquidHeader() {} - uint32 CountXVertices; - uint32 CountYVertices; - uint32 Width; - uint32 Height; - Vector3 BaseLocation; - uint16 MaterialId; - - static LiquidHeader Read(FILE* stream); -}; - -class LiquidData -{ -public: - LiquidData() {} - float** HeightMap; - uint8** RenderFlags; - - bool ShouldRender(int x, int y) - { - return RenderFlags[x][y] != 0x0F; - } - - static LiquidData Read(FILE* stream, LiquidHeader& header); -}; - -class H2ORenderMask -{ -public: - H2ORenderMask() {} - uint8 Mask[8]; - - bool ShouldRender(int x, int y) - { - return (Mask[y] >> x & 1) != 0; - } - - static H2ORenderMask Read(FILE* stream); -}; - -class MCNKLiquidData -{ -public: - MCNKLiquidData() {} - MCNKLiquidData(float** heights, H2ORenderMask mask) : Heights(heights), Mask(mask) {} - - float** Heights; - H2ORenderMask Mask; - - bool IsWater(int x, int y, float height); -}; - -class H2OHeader -{ -public: - H2OHeader() {} - uint32 OffsetInformation; - uint32 LayerCount; - uint32 OffsetRender; - - static H2OHeader Read(FILE* stream); -}; - -class H2OInformation -{ -public: - H2OInformation() {} - uint16 LiquidType; - uint16 Flags; - float HeightLevel1; - float HeightLevel2; - uint8 OffsetX; - uint8 OffsetY; - uint8 Width; - uint8 Height; - uint32 OffsetMask2; - uint32 OffsetHeightmap; - - static H2OInformation Read(FILE* stream); -}; - -class WMOGroupHeader -{ -public: - WMOGroupHeader() {} - - uint32 OffsetGroupName; - uint32 OffsetDescriptiveName; - uint32 Flags; - Vector3 BoundingBox[2]; - uint32 OffsetPortals; - uint32 CountPortals; - uint16 CountBatches[4]; - uint8 Fogs[4]; - uint32 LiquidTypeRelated; - uint32 WmoId; - - static WMOGroupHeader Read(FILE* stream); -}; - -// Dummy class to act as an interface. -class IDefinition -{ -public: - Vector3 Position; - Vector3 Rotation; - virtual float Scale() const { return 1.0f; }; -}; - -#define MMAP_MAGIC 0x4d4d4150 // 'MMAP' -#define MMAP_VERSION 3 - -struct MmapTileHeader -{ - uint32 mmapMagic; - uint32 dtVersion; - uint32 mmapVersion; - uint32 size; - bool usesLiquids; - - MmapTileHeader() : mmapMagic(MMAP_MAGIC), dtVersion(DT_NAVMESH_VERSION), - mmapVersion(MMAP_VERSION), size(0), usesLiquids(true) {} -}; - -class Utils -{ -public: - static void Reverse(char word[]); - static std::string ReadString(FILE* file); - static uint32 Size(FILE* file); - static Vector3 ToRecast(const Vector3& val ); - static std::string GetAdtPath(const std::string& world, int x, int y); - static std::string FixModelPath(const std::string& path); - /// They say its better to declare template functions in the header files. - template - static std::string ToString(T val) - { - std::stringstream ss; - ss << val; - return ss.str(); - } - static float ToRadians(float degrees); - static std::string GetPathBase(const std::string& path); - static Vector3 GetLiquidVert(const IDefinition& def, Vector3 basePosition, float height, int /*x*/, int /*y*/, bool translate = true); - static float Distance(float x, float y); - template - static bool IsAllZero(T* arr, uint32 size) - { - for (uint32 i = 0; i < size; ++i) - if (arr[i]) - return false; - return true; - } - static std::string Replace( std::string str, const std::string& oldStr, const std::string& newStr ); - static void CreateDir( const std::string& Path ); - static void SaveToDisk(FILE* stream, const std::string& path); - static Vector3 ToWoWCoords(const Vector3& vec ); - static std::string GetExtension( std::string path ); - static char* GetPlainName(const char* FileName); - static Vector3 TransformDoodadVertex(const IDefinition& def, Vector3& vec, bool translate = true); - static Vector3 VectorTransform(const Vector3& vec, const G3D::Matrix4& matrix, bool normal = false ); - static Vector3 TransformWmoDoodad(const DoodadInstance& inst, const WorldModelDefinition& root, Vector3& vec, bool translate = true ); -}; -#endif diff --git a/src/tools/mesh_extractor/WDT.cpp b/src/tools/mesh_extractor/WDT.cpp deleted file mode 100644 index 707a44611a..0000000000 --- a/src/tools/mesh_extractor/WDT.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "WDT.h" -#include "Chunk.h" -#include "ChunkedData.h" -#include "Utils.h" -#include "WorldModelHandler.h" - -WDT::WDT(std::string file) : IsGlobalModel(false), IsValid(false), Model(NULL) -{ - Data = new ChunkedData(file, 2); - ReadTileTable(); - ReadGlobalModel(); -} - -void WDT::ReadGlobalModel() -{ - Chunk* fileChunk = Data->GetChunkByName("MWMO"); - Chunk* defChunk = Data->GetChunkByName("MODF"); - if (!fileChunk || !defChunk) - return; - - IsGlobalModel = true; - ModelDefinition = WorldModelDefinition::Read(defChunk->GetStream()); - ModelFile = Utils::ReadString(fileChunk->GetStream()); - Model = new WorldModelRoot(ModelFile); -} - -void WDT::ReadTileTable() -{ - Chunk* chunk = Data->GetChunkByName("MAIN"); - if (!chunk) - return; - IsValid = true; - FILE* stream = chunk->GetStream(); - for (int y = 0; y < 64; ++y) - { - for (int x = 0; x < 64; ++x) - { - const uint32 hasTileFlag = 0x1; - uint32 flags; - uint32 discard; - int count = 0; - count += fread(&flags, sizeof(uint32), 1, stream); - count += fread(&discard, sizeof(uint32), 1, stream); - - if (count != 2) - printf("WDT::ReadTileTable: Failed to read some data expected 2, read %d\n", count); - - if (flags & hasTileFlag) - TileTable.push_back(TilePos(x, y)); - - } - } -} - -bool WDT::HasTile( int x, int y ) -{ - for (std::vector::iterator itr = TileTable.begin(); itr != TileTable.end(); ++itr) - if (itr->X == x && itr->Y == y) - return true; - return false; -} diff --git a/src/tools/mesh_extractor/WDT.h b/src/tools/mesh_extractor/WDT.h deleted file mode 100644 index b0961c03ed..0000000000 --- a/src/tools/mesh_extractor/WDT.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef WDT_H -#define WDT_H -#include -#include - -#include "ChunkedData.h" -#include "WorldModelHandler.h" -#include "WorldModelRoot.h" -#include "Utils.h" - -class WDT -{ -public: - WDT(std::string file); - - ChunkedData* Data; - std::vector TileTable; - bool IsGlobalModel; - bool IsValid; - std::string ModelFile; - WorldModelDefinition ModelDefinition; - WorldModelRoot* Model; - bool HasTile(int x, int y); -private: - void ReadGlobalModel(); - void ReadTileTable(); -}; - -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/WorldModelGroup.cpp b/src/tools/mesh_extractor/WorldModelGroup.cpp deleted file mode 100644 index 71ca604a57..0000000000 --- a/src/tools/mesh_extractor/WorldModelGroup.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "WorldModelGroup.h" -#include "ChunkedData.h" -#include "Chunk.h" -#include "Utils.h" - -WorldModelGroup::WorldModelGroup( std::string path, int groupIndex ) : GroupIndex(groupIndex), MOBA(NULL), IsBad(false), HasLiquidData(false) -{ - Data = new ChunkedData(path); - if (!Data->Stream) - { - IsBad = true; - return; - } - Chunk* mainChunk = Data->GetChunkByName("MOGP"); - int32 firstSub = mainChunk->FindSubChunkOffset("MOPY"); - if (firstSub == -1) - return; - - Name = Utils::GetPlainName(path.c_str()); - - FILE* stream = mainChunk->GetStream(); - fseek(stream, firstSub, SEEK_SET); - SubData = new ChunkedData(stream, mainChunk->Length - firstSub); - - ReadHeader(); - ReadMaterials(); - ReadTriangles(); - ReadVertices(); - ReadNormals(); - ReadLiquid(); - ReadBatches(); -} - -void WorldModelGroup::ReadNormals() -{ - Chunk* chunk = SubData->GetChunkByName("MONR"); - if (!chunk) - return; - - uint32 normalCount = chunk->Length / 12; - ASSERT(normalCount == Vertices.size() && "normalCount is different than the Vertices count"); - Normals.reserve(normalCount); - FILE* stream = chunk->GetStream(); - for (uint32 i = 0; i < normalCount; i++) - Normals.push_back(Vector3::Read(stream)); -} - -void WorldModelGroup::ReadLiquid() -{ - Chunk* chunk = SubData->GetChunkByName("MLIQ"); - if (!chunk) - return; - - HasLiquidData = true; - FILE* stream = chunk->GetStream(); - LiquidDataHeader = LiquidHeader::Read(stream); - LiquidDataGeometry = LiquidData::Read(stream, LiquidDataHeader); -} - -void WorldModelGroup::ReadVertices() -{ - Chunk* chunk = SubData->GetChunkByName("MOVT"); - if (!chunk) - return; - - uint32 verticeCount = chunk->Length / 12; - Vertices.reserve(verticeCount); - FILE* stream = chunk->GetStream(); - for (uint32 i = 0; i < verticeCount; i++) - Vertices.push_back(Vector3::Read(stream)); -} - -void WorldModelGroup::ReadTriangles() -{ - Chunk* chunk = SubData->GetChunkByName("MOVI"); - if (!chunk) - return; - - uint32 triangleCount = chunk->Length / 6; - ASSERT(triangleCount == TriangleFlags.size() && "triangleCount != TriangleFlags.size()"); - FILE* stream = chunk->GetStream(); - Triangles.reserve(triangleCount); - for (uint32 i = 0; i < triangleCount; i++) - { - uint16 v0; - uint16 v1; - uint16 v2; - int count = 0; - count += fread(&v0, sizeof(uint16), 1, stream); - count += fread(&v1, sizeof(uint16), 1, stream); - count += fread(&v2, sizeof(uint16), 1, stream); - if (count != 3) - printf("WorldModelGroup::ReadMaterials: Error reading data, expected 3, read %d\n", count); - - Triangles.push_back(Triangle(Constants::TRIANGLE_TYPE_WMO, v0, v1, v2)); - } -} - -void WorldModelGroup::ReadMaterials() -{ - Chunk* chunk = SubData->GetChunkByName("MOPY"); - if (!chunk) - return; - - FILE* stream = chunk->GetStream(); - uint32 triangleCount = chunk->Length / 2; - TriangleFlags.reserve(triangleCount); - TriangleMaterials.reserve(triangleCount); - for (uint32 i = 0; i < triangleCount; i++) - { - uint8 tmp; - if (fread(&tmp, sizeof(uint8), 1, stream) != 1) - printf("WorldModelGroup::ReadMaterials: Error reading data, expected 1, read 0\n"); - TriangleFlags.push_back(tmp); - // Read again for material. - if (fread(&tmp, sizeof(uint8), 1, stream) != 1) - printf("WorldModelGroup::ReadMaterials: Error reading data, expected 1, read 0\n"); - TriangleMaterials.push_back(tmp); - } -} - -void WorldModelGroup::ReadHeader() -{ - Chunk* chunk = Data->GetChunkByName("MOGP"); - if (!chunk) - return; - - FILE* stream = chunk->GetStream(); - Header = WMOGroupHeader::Read(stream); -} - -void WorldModelGroup::ReadBatches() -{ - Chunk* chunk = Data->GetChunkByName("MOBA"); - if (!chunk) - return; - - MOBALength = chunk->Length / 2; - MOBA = new uint16[MOBALength]; - uint32 count = (uint32)fread(MOBA, sizeof(uint16), MOBALength, chunk->GetStream()); - if (count != MOBALength) - printf("WorldModelGroup::ReadBatches: Error reading data, expected %u, read %u\n", MOBALength, count); -} diff --git a/src/tools/mesh_extractor/WorldModelGroup.h b/src/tools/mesh_extractor/WorldModelGroup.h deleted file mode 100644 index 9ce5a11e07..0000000000 --- a/src/tools/mesh_extractor/WorldModelGroup.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef WMOGROUP_H -#define WMOGROUP_H -#include "ChunkedData.h" -#include "Utils.h" - -class WorldModelGroup -{ -public: - WorldModelGroup(std::string path, int groupIndex); - ChunkedData* Data; - ChunkedData* SubData; - int GroupIndex; - std::string Name; - WMOGroupHeader Header; - - std::vector TriangleFlags; - std::vector TriangleMaterials; - std::vector > Triangles; - std::vector Vertices; - std::vector Normals; - // @ToDo: Research. - uint16* MOBA; - uint32 MOBALength; - - bool HasLiquidData; - bool IsBad; - LiquidHeader LiquidDataHeader; - LiquidData LiquidDataGeometry; -private: - void ReadNormals(); - void ReadLiquid(); - void ReadVertices(); - void ReadTriangles(); - void ReadMaterials(); - void ReadHeader(); - void ReadBatches(); -}; -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/WorldModelHandler.cpp b/src/tools/mesh_extractor/WorldModelHandler.cpp deleted file mode 100644 index b62f7f3435..0000000000 --- a/src/tools/mesh_extractor/WorldModelHandler.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "WorldModelHandler.h" -#include "WorldModelRoot.h" -#include "Chunk.h" -#include "Cache.h" -#include "Model.h" -#include "Define.h" -#include "G3D/Matrix4.h" -#include "G3D/Quat.h" -#include - -WorldModelDefinition WorldModelDefinition::Read( FILE* file ) -{ - WorldModelDefinition ret; - int count = 0; - count += fread(&ret.MwidIndex, sizeof(uint32), 1, file); - count += fread(&ret.UniqueId, sizeof(uint32), 1, file); - ret.Position = Vector3::Read(file); - ret.Rotation = Vector3::Read(file); - ret.UpperExtents = Vector3::Read(file); - ret.LowerExtents = Vector3::Read(file); - count += fread(&ret.Flags, sizeof(uint16), 1, file); - count += fread(&ret.DoodadSet, sizeof(uint16), 1, file); - uint32 discard; - count += fread(&discard, sizeof(uint32), 1, file); - - if (count != 5) - printf("WorldModelDefinition::Read: Error reading data, expected 5, read %d\n", count); - return ret; -} - - -WorldModelHandler::WorldModelHandler( ADT* adt ) : ObjectDataHandler(adt), _definitions(NULL), _paths(NULL) -{ - ReadModelPaths(); - ReadDefinitions(); -} - -void WorldModelHandler::ProcessInternal( MapChunk* mcnk ) -{ - if (!IsSane()) - return; - - uint32 refCount = mcnk->Header.MapObjectRefs; - FILE* stream = mcnk->Source->GetStream(); - fseek(stream, mcnk->Source->Offset + mcnk->Header.OffsetMCRF, SEEK_SET); - // Start looping at the last Doodad Ref index - for (uint32 i = mcnk->Header.DoodadRefs; i < refCount; i++) - { - int32 index; - if (fread(&index, sizeof(int32), 1, stream) != 1) - printf("WorldModelDefinition::Read: Error reading data, expected 1, read 0\n"); - - if (index < 0 || uint32(index) >= _definitions->size()) - continue; - - WorldModelDefinition wmo = (*_definitions)[index]; - - if (_drawn.find(wmo.UniqueId) != _drawn.end()) - continue; - _drawn.insert(wmo.UniqueId); - - if (wmo.MwidIndex >= _paths->size()) - continue; - - std::string path = (*_paths)[wmo.MwidIndex]; - WorldModelRoot* model = Cache->WorldModelCache.Get(path); - if (!model) - { - model = new WorldModelRoot(path); - Cache->WorldModelCache.Insert(path, model); - } - - Vertices.reserve(1000); - Triangles.reserve(1000); - - InsertModelGeometry(Vertices, Triangles, wmo, model); - } - // Restore the stream position - fseek(stream, mcnk->Source->Offset, SEEK_SET); -} - -void WorldModelHandler::InsertModelGeometry( std::vector& verts, std::vector >& tris, const WorldModelDefinition& def, WorldModelRoot* root, bool translate ) -{ - for (std::vector::iterator group = root->Groups.begin(); group != root->Groups.end(); ++group) - { - uint32 vertOffset = verts.size(); - for (std::vector::iterator itr2 = group->Vertices.begin(); itr2 != group->Vertices.end(); ++itr2) - { - Vector3 v = Utils::TransformDoodadVertex(def, *itr2, translate); - // If translate is false, then we were called directly from the TileBuilder to add data to it's _Geometry member, hence, we have to manually convert the vertices to Recast format. - verts.push_back(translate ? v : Utils::ToRecast(v)); // Transform the vertex to world space - } - - for (uint32 i = 0; i < group->Triangles.size(); ++i) - { - // only include colliding tris - if ((group->TriangleFlags[i] & 0x04) != 0 && group->TriangleMaterials[i] != 0xFF) - continue; - Triangle tri = group->Triangles[i]; - tris.push_back(Triangle(Constants::TRIANGLE_TYPE_WMO, tri.V0 + vertOffset, tri.V1 + vertOffset, tri.V2 + vertOffset)); - } - } - - if (def.DoodadSet < root->DoodadSets.size()) - { - DoodadSet set = root->DoodadSets[def.DoodadSet]; - std::vector instances; - instances.reserve(set.CountInstances); - for (uint32 i = set.FirstInstanceIndex; i < (set.CountInstances + set.FirstInstanceIndex); i++) - { - if (i >= root->DoodadInstances.size()) - break; - instances.push_back(root->DoodadInstances[i]); - } - - for (std::vector::iterator instance = instances.begin(); instance != instances.end(); ++instance) - { - Model* model = Cache->ModelCache.Get(instance->File); - if (!model) - { - model = new Model(instance->File); - Cache->ModelCache.Insert(instance->File, model); - } - - if (!model->IsCollidable) - continue; - int vertOffset = verts.size(); - for (std::vector::iterator itr2 = model->Vertices.begin(); itr2 != model->Vertices.end(); ++itr2) - { - Vector3 v = Utils::TransformDoodadVertex(def, Utils::TransformWmoDoodad(*instance, def, *itr2, false), translate); - verts.push_back(translate ? v : Utils::ToRecast(v)); - } - for (std::vector >::iterator itr2 = model->Triangles.begin(); itr2 != model->Triangles.end(); ++itr2) - tris.push_back(Triangle(Constants::TRIANGLE_TYPE_WMO, itr2->V0 + vertOffset, itr2->V1 + vertOffset, itr2->V2 + vertOffset)); - } - - for (std::vector::iterator group = root->Groups.begin(); group != root->Groups.end(); ++group) - { - if (!group->HasLiquidData) - continue; - - const LiquidHeader& liquidHeader = group->LiquidDataHeader; - LiquidData& liquidDataGeometry = group->LiquidDataGeometry; - - for (uint32 y = 0; y < liquidHeader.Height; y++) - { - for (uint32 x = 0; x < liquidHeader.Width; x++) - { - - if (!liquidDataGeometry.ShouldRender(x, y)) - continue; - - uint32 vertOffset = verts.size(); - - Vector3 v1 = Utils::GetLiquidVert(def, liquidHeader.BaseLocation, - liquidDataGeometry.HeightMap[x][y], x, y, translate); - Vector3 v2 = Utils::GetLiquidVert(def, liquidHeader.BaseLocation, - liquidDataGeometry.HeightMap[x + 1][y], x + 1, y, translate); - Vector3 v3 = Utils::GetLiquidVert(def, liquidHeader.BaseLocation, - liquidDataGeometry.HeightMap[x][y + 1], x, y + 1, translate); - Vector3 v4 = Utils::GetLiquidVert(def, liquidHeader.BaseLocation, - liquidDataGeometry.HeightMap[x + 1][y + 1], x + 1, y + 1, translate); - - verts.push_back(translate ? v1 : Utils::ToRecast(v1)); - verts.push_back(translate ? v2 : Utils::ToRecast(v2)); - verts.push_back(translate ? v3 : Utils::ToRecast(v3)); - verts.push_back(translate ? v4 : Utils::ToRecast(v4)); - - tris.push_back(Triangle(Constants::TRIANGLE_TYPE_WATER, vertOffset, vertOffset + 2, vertOffset + 1)); - tris.push_back(Triangle(Constants::TRIANGLE_TYPE_WATER, vertOffset + 2, vertOffset + 3, vertOffset + 1)); - - } - } - } - } -} - -void WorldModelHandler::ReadDefinitions() -{ - Chunk* chunk = Source->ObjectData->GetChunkByName("MODF"); - if (!chunk) - return; - - const int32 definitionSize = 64; - uint32 definitionCount = chunk->Length / definitionSize; - _definitions = new std::vector; - _definitions->reserve(definitionCount); - FILE* stream = chunk->GetStream(); - for (uint32 i = 0; i < definitionCount; i++) - _definitions->push_back(WorldModelDefinition::Read(stream)); -} - -void WorldModelHandler::ReadModelPaths() -{ - Chunk* mwid = Source->ObjectData->GetChunkByName("MWID"); - Chunk* mwmo = Source->ObjectData->GetChunkByName("MWMO"); - if (!mwid || !mwmo) - return; - - uint32 paths = mwid->Length / 4; - _paths = new std::vector; - _paths->reserve(paths); - for (uint32 i = 0; i < paths; i++) - { - FILE* stream = mwid->GetStream(); - fseek(stream, i * 4, SEEK_CUR); - uint32 offset; - if (fread(&offset, sizeof(uint32), 1, stream) != 1) - printf("WorldModelDefinition::Read: Error reading data, expected 1, read 0\n"); - FILE* dataStream = mwmo->GetStream(); - fseek(dataStream, offset + mwmo->Offset, SEEK_SET); - _paths->push_back(Utils::ReadString(dataStream)); - } -} - -WorldModelHandler::~WorldModelHandler() -{ - delete _definitions; - delete _paths; -} diff --git a/src/tools/mesh_extractor/WorldModelHandler.h b/src/tools/mesh_extractor/WorldModelHandler.h deleted file mode 100644 index fdb31a35c4..0000000000 --- a/src/tools/mesh_extractor/WorldModelHandler.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef WMODEL_HNDL_H -#define WMODEL_HNDL_H -#include "Define.h" -#include "Utils.h" -#include "WorldModelRoot.h" -#include "ObjectDataHandler.h" - -#include -#include - -class ADT; - -struct WorldModelDefinition : public IDefinition -{ -public: - WorldModelDefinition() {} - - uint32 MwidIndex; - uint32 UniqueId; - Vector3 UpperExtents; - Vector3 LowerExtents; - uint16 Flags; - uint16 DoodadSet; - - static WorldModelDefinition Read(FILE* file); -}; - -class WorldModelHandler : public ObjectDataHandler -{ -public: - WorldModelHandler(ADT* adt); - ~WorldModelHandler(); - - std::vector Vertices; - std::vector > Triangles; - bool IsSane() { return _definitions && _paths; } - static void InsertModelGeometry(std::vector& verts, std::vector >& tris, const WorldModelDefinition& def, WorldModelRoot* root, bool translate = true); -protected: - void ProcessInternal(MapChunk* data); -private: - void ReadDefinitions(); - void ReadModelPaths(); - std::set _drawn; - std::vector* _definitions; - std::vector* _paths; -}; -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/WorldModelRoot.cpp b/src/tools/mesh_extractor/WorldModelRoot.cpp deleted file mode 100644 index f75b2eead3..0000000000 --- a/src/tools/mesh_extractor/WorldModelRoot.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#include "WorldModelRoot.h" -#include "ChunkedData.h" -#include "Utils.h" - -WorldModelRoot::WorldModelRoot( std::string path ) -{ - Data = new ChunkedData(path); - Path = path; - ReadHeader(); - ReadGroups(); - ReadDoodadInstances(); - ReadDoodadSets(); -} - -WorldModelRoot::~WorldModelRoot() -{ - delete Data; -} - -void WorldModelRoot::ReadGroups() -{ - std::string pathBase = Utils::GetPathBase(Path); - Groups.reserve(Header.CountGroups); - for (uint32 i = 0; i < Header.CountGroups; i++) - { - char name[200]; - sprintf(name, "%s_%03u.wmo", pathBase.c_str(), i); - WorldModelGroup group(name, i); - if (!group.IsBad) - Groups.push_back(group); - } -} - -void WorldModelRoot::ReadDoodadSets() -{ - Chunk* chunk = Data->GetChunkByName("MODS"); - if (!chunk) - return; - - FILE* stream = chunk->GetStream(); - ASSERT(chunk->Length / 32 == Header.CountSets && "chunk.Length / 32 == Header.CountSets"); - DoodadSets.reserve(Header.CountSets); - for (uint32 i = 0; i < Header.CountSets; i++) - DoodadSets.push_back(DoodadSet::Read(stream)); -} - -void WorldModelRoot::ReadDoodadInstances() -{ - Chunk* chunk = Data->GetChunkByName("MODD"); - Chunk* nameChunk = Data->GetChunkByName("MODN"); - if (!chunk || !nameChunk) - return; - - const uint32 instanceSize = 40; - uint32 countInstances = chunk->Length / instanceSize; - DoodadInstances.reserve(countInstances); - for (uint32 i = 0; i < countInstances; i++) - { - FILE* stream = chunk->GetStream(); - fseek(stream, instanceSize * i, SEEK_CUR); - DoodadInstance instance = DoodadInstance::Read(stream); - FILE* nameStream = nameChunk->GetStream(); - if (instance.FileOffset >= nameChunk->Length) - continue; - fseek(nameStream, instance.FileOffset, SEEK_CUR); - instance.File = Utils::ReadString(nameStream); - DoodadInstances.push_back(instance); - } -} - -void WorldModelRoot::ReadHeader() -{ - Chunk* chunk = Data->GetChunkByName("MOHD"); - if (!chunk) - return; - - FILE* stream = chunk->GetStream(); - Header = WorldModelHeader::Read(stream); -} diff --git a/src/tools/mesh_extractor/WorldModelRoot.h b/src/tools/mesh_extractor/WorldModelRoot.h deleted file mode 100644 index 1be2086b46..0000000000 --- a/src/tools/mesh_extractor/WorldModelRoot.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore - * - * 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 . - */ - -#ifndef WMOROOT_H -#define WMOROOT_H -#include -#include - -#include "ChunkedData.h" -#include "Utils.h" -#include "WorldModelGroup.h" - -class WorldModelRoot -{ -public: - WorldModelRoot(std::string path); - ~WorldModelRoot(); - std::string Path; - ChunkedData* Data; - WorldModelHeader Header; - std::vector DoodadInstances; - std::vector DoodadSets; - std::vector Groups; -private: - void ReadGroups(); - void ReadDoodadSets(); - void ReadDoodadInstances(); - void ReadHeader(); -}; -#endif \ No newline at end of file diff --git a/src/tools/mesh_extractor/readme b/src/tools/mesh_extractor/readme deleted file mode 100644 index 85cd7cfc97..0000000000 --- a/src/tools/mesh_extractor/readme +++ /dev/null @@ -1,6 +0,0 @@ -Experimental mesh extractor. -Original work in C# by stschake -Thanks to: -Subv -~ -For helping in the porting to C++ \ No newline at end of file From 2ed0af7d752bf0e0686fe7fde04453685831de33 Mon Sep 17 00:00:00 2001 From: Nayd Date: Sun, 25 Jan 2015 15:26:30 +0000 Subject: [PATCH 31/33] Fix typo in CMakeLists.txt --- src/tools/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index d806858eea..350c8becb3 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -12,4 +12,3 @@ add_subdirectory(map_extractor) add_subdirectory(vmap4_assembler) add_subdirectory(vmap4_extractor) add_subdirectory(mmaps_generator) -endif() From 0b8a86886bec1979b698b4109c1f667ba1257fc0 Mon Sep 17 00:00:00 2001 From: Hristo Bogdanov Date: Mon, 26 Jan 2015 19:15:06 +0000 Subject: [PATCH 32/33] Core/Creatures: No gray aggro config (Custom) Adds option to disable aggro from gray creatures when the players are above/below certain levels. Closes #13919 --- .../game/Entities/Creature/Creature.cpp | 20 +++++++++++++++++++ src/server/game/Entities/Creature/Creature.h | 1 + src/server/game/World/World.cpp | 19 ++++++++++++++++++ src/server/game/World/World.h | 2 ++ src/server/worldserver/worldserver.conf.dist | 15 ++++++++++++++ 5 files changed, 57 insertions(+) diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 37d102cc77..a44ca68f79 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1407,9 +1407,29 @@ bool Creature::CanStartAttack(Unit const* who, bool force) const if (!CanCreatureAttack(who, force)) return false; + // No aggro from gray creatures + if (CheckNoGrayAggroConfig(who->getLevelForTarget(this), getLevelForTarget(who))) + return false; + return IsWithinLOSInMap(who); } + +bool Creature::CheckNoGrayAggroConfig(uint32 playerLevel, uint32 creatureLevel) const +{ + if (Trinity::XP::GetColorCode(playerLevel, creatureLevel) != XP_GRAY) + return false; + + uint32 notAbove = sWorld->getIntConfig(CONFIG_NO_GRAY_AGGRO_ABOVE); + uint32 notBelow = sWorld->getIntConfig(CONFIG_NO_GRAY_AGGRO_BELOW); + if (notAbove == 0 && notBelow == 0) + return false; + + if (playerLevel <= notBelow || (playerLevel >= notAbove && notAbove > 0)) + return true; + return false; +} + float Creature::GetAttackDistance(Unit const* player) const { float aggroRate = sWorld->getRate(RATE_CREATURE_AGGRO); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 18f574d030..ec06bf9059 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -731,6 +731,7 @@ class Creature : public Unit, public GridObject, public MapObject private: void ForcedDespawn(uint32 timeMSToDespawn = 0); + bool CheckNoGrayAggroConfig(uint32 playerLevel, uint32 creatureLevel) const; // No aggro from gray creatures //WaypointMovementGenerator vars uint32 m_waypointID; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 5e11e37f61..555f89aad8 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1121,6 +1121,25 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_CHARDELETE_HEROIC_MIN_LEVEL] = sConfigMgr->GetIntDefault("CharDelete.Heroic.MinLevel", 0); m_int_configs[CONFIG_CHARDELETE_KEEP_DAYS] = sConfigMgr->GetIntDefault("CharDelete.KeepDays", 30); + // No aggro from gray mobs + m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE] = sConfigMgr->GetIntDefault("NoGrayAggro.Above", 0); + m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW] = sConfigMgr->GetIntDefault("NoGrayAggro.Below", 0); + if (m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) + { + TC_LOG_ERROR("server.loading", "NoGrayAggro.Above (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL]; + } + if (m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) + { + TC_LOG_ERROR("server.loading", "NoGrayAggro.Below (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL]; + } + if (m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE] > 0 && m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE] < m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW]) + { + TC_LOG_ERROR("server.loading", "NoGrayAggro.Below (%i) cannot be greater than NoGrayAggro.Above (%i). Set to %i.", m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW], m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE], m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE]); + m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW] = m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE]; + } + ///- Read the "Data" directory from the config file std::string dataPath = sConfigMgr->GetStringDefault("DataDir", "./"); if (dataPath.empty() || (dataPath.at(dataPath.length()-1) != '/' && dataPath.at(dataPath.length()-1) != '\\')) diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index c7b5cfeeed..95c737936b 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -345,6 +345,8 @@ enum WorldIntConfigs CONFIG_CHARTER_COST_ARENA_2v2, CONFIG_CHARTER_COST_ARENA_3v3, CONFIG_CHARTER_COST_ARENA_5v5, + CONFIG_NO_GRAY_AGGRO_ABOVE, + CONFIG_NO_GRAY_AGGRO_BELOW, INT_CONFIG_VALUE_COUNT }; diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 6a1d9706b3..eaef902add 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2690,6 +2690,21 @@ Calculate.Creature.Zone.Area.Data = 0 Calculate.Gameoject.Zone.Area.Data = 0 +# +# NoGrayAggro +# Description: Gray mobs will not aggro players above/below some levels +# NoGrayAggro.Above: If player is at this level or above, gray mobs will not attack +# NoGrayAggro.Below: If player is at this level or below, gray mobs will not attack +# Example: You can for example make players free from gray until they reach level 30. +# Then gray will start to attack them, until they reach max level (80 for example): +# NoGrayAggro.Above = 80 +# NoGrayAggro.Below = 29 +# Default: 0 - (Blizzlike) +# + +NoGrayAggro.Above = 0 +NoGrayAggro.Below = 0 + # ################################################################################################### From ccdc100d10143285bc058d968f0472ea4d073120 Mon Sep 17 00:00:00 2001 From: Dr-J Date: Tue, 27 Jan 2015 21:50:28 +0000 Subject: [PATCH 33/33] DB/Misc: Trayanise Script http://www.wowhead.com/npc=18230/trayanise from sniff Only the Tiny Arcane Construct appears to have fixed WP ie same waypoints repeat in sniff over and over while trayanise waypoints are different each time, Also adds the texts to this npc --- sql/updates/world/2015_01_27_00_world.sql | 56 +++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 sql/updates/world/2015_01_27_00_world.sql diff --git a/sql/updates/world/2015_01_27_00_world.sql b/sql/updates/world/2015_01_27_00_world.sql new file mode 100644 index 0000000000..5b96411084 --- /dev/null +++ b/sql/updates/world/2015_01_27_00_world.sql @@ -0,0 +1,56 @@ +UPDATE `creature_template` SET `ainame`='SmartAI', `scriptname`='' WHERE `entry` IN(18230,18237); + +DELETE FROM `smart_scripts` WHERE `entryorguid` IN(18230,18237) AND `source_type`=0; + +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(18230, 0, 0, 0, 1, 0, 100, 0, 0, 0, 500, 500, 29, 0, 0, 0, 0, 0, 0, 19, 18237, 0, 0, 0, 0, 0, 0, 'Trayanise - OOC - Follow Tiny Arcane Construct'), +(18230, 0, 1, 0, 1, 0, 100, 0, 0, 60000, 180000, 300000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Trayanise - OOC - Say Line 0'), +(18237, 0, 0, 0, 11, 0, 100, 0, 0, 0, 0, 0, 53, 1, 18237, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Tiny Arcane Construct - On Spawn - Start WP'); + +UPDATE `creature_template` SET `speed_run`=1.142857 WHERE `entry`=18230; +UPDATE `creature_template` SET `speed_run`=2.142857 WHERE `entry`=18237; + +DELETE FROM `creature_addon` WHERE `guid` IN(65501,65505); +INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `auras`) VALUES +(65501, 0, 0, 0x0, 0x1, 0, NULL), +(65505, 0, 0, 0x0, 0x1, 0, NULL); + +DELETE FROM `creature_template_addon` WHERE `entry` IN(18230,18237); + +DELETE FROM `creature` WHERE `guid` IN(65501,65505); +INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `MovementType`) VALUES +(65501, 18230, 530, 1, 1, 9891.047, -7180.686, 31.02935, 2.363085, 120, 0, 0), -- 18230 (Area: 3487) +(65505, 18237, 530, 1, 1, 9886.445, -7179.344, 31.03508, 2.353462, 120, 0, 0); -- 18237 (Area: 3487) + + +DELETE FROM `waypoint_data` WHERE `id` IN(655010,655050); + +DELETE FROM `waypoints` WHERE `entry` IN(18230,18237); +INSERT INTO `waypoints` (`entry`, `pointid`, `position_x`, `position_y`, `position_z`, `point_comment`) VALUES +(18237, 1, 9854.372, -7131.53, 30.8774, 'Tiny Arcane Construct'), +(18237, 2, 9848.939, -7149.687, 30.88104, 'Tiny Arcane Construct'), +(18237, 3, 9853.528, -7164.35, 30.94116, 'Tiny Arcane Construct'), +(18237, 4, 9873.93, -7174.143, 31.04511, 'Tiny Arcane Construct'), +(18237, 5, 9890.317, -7171.364, 32.04652, 'Tiny Arcane Construct'), +(18237, 6, 9893.691, -7182.642, 31.02659, 'Tiny Arcane Construct'), +(18237, 7, 9906.294, -7211.048, 30.9103, 'Tiny Arcane Construct'), +(18237, 8, 9914.21, -7215.013, 30.81886, 'Tiny Arcane Construct'), +(18237, 9, 9930.763, -7214.394, 30.86104, 'Tiny Arcane Construct'), +(18237, 10, 9954.362, -7211.773, 30.87779, 'Tiny Arcane Construct'), +(18237, 11, 9953.68, -7204.061, 30.87768, 'Tiny Arcane Construct'), +(18237, 12, 9941.922, -7198.434, 30.87755, 'Tiny Arcane Construct'), +(18237, 13, 9915.126, -7188.168, 30.9569, 'Tiny Arcane Construct'), +(18237, 14, 9897.4, -7190.357, 31.03786, 'Tiny Arcane Construct'), +(18237, 15, 9885.156, -7178.048, 31.03413, 'Tiny Arcane Construct'), +(18237, 16, 9874.851, -7163.025, 30.99726, 'Tiny Arcane Construct'), +(18237, 17, 9867.523, -7139.578, 30.87733, 'Tiny Arcane Construct'); + +DELETE FROM `creature_text` WHERE `entry`=18230; +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `BroadcastTextID`, `comment`) VALUES +(18230, 0, 0, 'The magister''s going to kill me...', 12, 1, 100, 0, 0, 0, 15011, 'Trayanise'), +(18230, 0, 1, 'No, no, no! Come back here!', 12, 1, 100, 0, 0, 0, 15010, 'Trayanise'), +(18230, 0, 2, 'Argh. They told me those crystals would work properly!', 12, 1, 100, 0, 0, 0, 15013, 'Trayanise'), +(18230, 0, 3, 'When I catch you, I''m going to disenchant your components, so help me...', 12, 1, 100, 0, 0, 0, 15015, 'Trayanise'), +(18230, 0, 4, 'Get back here, you little...', 12, 1, 100, 0, 0, 0, 15012, 'Trayanise'), +(18230, 0, 5, 'You stay out of the regent lord''s way! I mean it!', 12, 1, 100, 0, 0, 0, 15014, 'Trayanise'); +