From b4be02c8a0f48b68b094a1bc00caabf1f4e06d05 Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 30 Dec 2012 16:03:25 -0500 Subject: [PATCH 1/5] Core/Conditions: Rename CONDITION_INSTANCE_DATA to CONDITION_INSTANCE_INFO. And allow it to be used with GetData, GetData64 and GetBossState. --- src/server/game/Conditions/ConditionMgr.cpp | 26 +++++++++++++++++---- src/server/game/Conditions/ConditionMgr.h | 9 ++++++- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 37835618183..f66783fb89a 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -154,11 +154,27 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) case CONDITION_ACTIVE_EVENT: condMeets = sGameEventMgr->IsActiveEvent(ConditionValue1); break; - case CONDITION_INSTANCE_DATA: + case CONDITION_INSTANCE_INFO: { Map* map = object->GetMap(); - if (map && map->IsDungeon() && ((InstanceMap*)map)->GetInstanceScript()) - condMeets = ((InstanceMap*)map)->GetInstanceScript()->GetData(ConditionValue1) == ConditionValue2; + if (map && map->IsDungeon()) + { + if (InstanceScript const* instance = ((InstanceMap*)map)->GetInstanceScript()) + { + switch (ConditionValue3) + { + case INSTANCE_INFO_DATA: + condMeets = instance->GetData(ConditionValue1) == ConditionValue2; + break; + case INSTANCE_INFO_DATA64: + condMeets = instance->GetData64(ConditionValue1) == ConditionValue2; + break; + case INSTANCE_INFO_BOSS_STATE: + condMeets = instance->GetBossState(ConditionValue1) == ConditionValue2; + break; + } + } + } break; } case CONDITION_MAPID: @@ -367,7 +383,7 @@ uint32 Condition::GetSearcherTypeMaskForCondition() case CONDITION_ACTIVE_EVENT: mask |= GRID_MAP_TYPE_MASK_ALL; break; - case CONDITION_INSTANCE_DATA: + case CONDITION_INSTANCE_INFO: mask |= GRID_MAP_TYPE_MASK_ALL; break; case CONDITION_MAPID: @@ -1899,7 +1915,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) break; } case CONDITION_AREAID: - case CONDITION_INSTANCE_DATA: + case CONDITION_INSTANCE_INFO: break; case CONDITION_WORLD_STATE: { diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 807b75c4ee6..520e786a66a 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -46,7 +46,7 @@ enum ConditionTypes CONDITION_DRUNKENSTATE = 10, // DrunkenState 0, 0 true if player is drunk enough CONDITION_WORLD_STATE = 11, // index value 0 true if world has the value for the index CONDITION_ACTIVE_EVENT = 12, // event_id 0 0 true if event is active - CONDITION_INSTANCE_DATA = 13, // entry data 0 true if data is set in current instance + CONDITION_INSTANCE_INFO = 13, // entry data type true if the instance info defined by type (enum InstanceInfo) equals data. CONDITION_QUEST_NONE = 14, // quest_id 0 0 true if doesn't have quest saved CONDITION_CLASS = 15, // class 0 0 true if player's class is equal to class CONDITION_RACE = 16, // race 0 0 true if player's race is equal to race @@ -152,6 +152,13 @@ enum RelationType RELATION_MAX }; +enum InstanceInfo +{ + INSTANCE_INFO_DATA = 0, + INSTANCE_INFO_DATA64, + INSTANCE_INFO_BOSS_STATE +}; + enum { MAX_CONDITION_TARGETS = 3 From 0eb26feaf2e1ccc9ae9fc60c864d8f6b197aa8d9 Mon Sep 17 00:00:00 2001 From: Gacko Date: Mon, 31 Dec 2012 01:17:42 +0100 Subject: [PATCH 2/5] DB/SAI: Reforging the sword --- sql/updates/world/2012_12_31_00_world_sai.sql | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 sql/updates/world/2012_12_31_00_world_sai.sql diff --git a/sql/updates/world/2012_12_31_00_world_sai.sql b/sql/updates/world/2012_12_31_00_world_sai.sql new file mode 100644 index 00000000000..9e30c29f784 --- /dev/null +++ b/sql/updates/world/2012_12_31_00_world_sai.sql @@ -0,0 +1,23 @@ +-- Myralion Sunblaze +DELETE FROM `smart_scripts` WHERE `entryorguid`=36642 AND `source_type`=0; +INSERT INTO `smart_scripts`(`entryorguid`,`id`,`link`,`event_type`,`event_param1`,`action_type`,`action_param1`,`action_param2`,`target_type`,`comment`) VALUES +(36642,0,1,20,24558,83,2,0,1,'Myralion Sunblaze - Remove gossip and quest giver flag on quest complete'), +(36642,1,0,61,0,53,0,36642,1,'Myralion Sunblaze - Start WP on quest complete'), +(36642,2,3,40,1,54,10000,0,1,'Myralion Sunblaze - Stop WP on point reached'), -- SMART_ACTION_WP_STOP would break the following SMART_EVENT_WAYPOINT_REACHED. +(36642,3,0,61,0,80,3664200,0,1,'Myralion Sunblaze - Start timed event on point reached'), +(36642,4,0,38,50,43,0,28889,1,'Myralion Sunblaze - Mount on data set'), +(36642,5,6,40,2,1,3,0,1,'Myralion Sunblaze - Say 3 event on home reached'), +(36642,6,7,61,0,66,0,0,1,'Myralion Sunblaze - restore orientation event on home reached'), +(36642,7,0,61,0,81,2,0,1,'Myralion Sunblaze - restore npc flags event on home reached'); + +-- Caladis Brightspear +DELETE FROM `smart_scripts` WHERE `entryorguid`=36624 AND `source_type`=0; +INSERT INTO `smart_scripts`(`entryorguid`,`id`,`link`,`event_type`,`event_param1`,`action_type`,`action_param1`,`action_param2`,`target_type`,`comment`) VALUES +(36624,0,1,20,24454,83,2,0,1,'Caladis Brightspear - Remove gossip and quest giver flag on quest complete'), +(36624,1,0,61,0,53,0,36624,1,'Caladis Brightspear - Start WP on quest complete'), +(36624,2,3,40,1,54,10000,0,1,'Caladis Brightspear - Stop WP on point reached'), -- SMART_ACTION_WP_STOP would break the following SMART_EVENT_WAYPOINT_REACHED. +(36624,3,0,61,0,80,3662400,0,1,'Caladis Brightspear - Start timed event on point reached'), +(36624,4,0,38,50,43,0,28888,1,'Caladis Brightspear - Mount on data set'), +(36624,5,6,40,2,1,3,0,1,'Caladis Brightspear - Say 3 event on home reached'), +(36624,6,7,61,0,66,0,0,1,'Caladis Brightspear - restore orientation event on home reached'), +(36624,7,0,61,0,81,2,0,1,'Caladis Brightspear - restore npc flags event on home reached'); From b609b314b2cc3380c4cd82265c86b39154080098 Mon Sep 17 00:00:00 2001 From: click Date: Mon, 31 Dec 2012 12:09:22 +0100 Subject: [PATCH 3/5] CMake/Buildsystem: CMake adds /Zm1000 to MSVC by default - explicitly replace that in the flaglist with the lower boundary --- cmake/compiler/msvc/settings.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmake/compiler/msvc/settings.cmake b/cmake/compiler/msvc/settings.cmake index 0aa5d93a4b3..d816a31405d 100644 --- a/cmake/compiler/msvc/settings.cmake +++ b/cmake/compiler/msvc/settings.cmake @@ -51,6 +51,7 @@ if(NOT WITH_WARNINGS) endif() endif() -# Specify Precompiled Header Memory Allocation Limit -# (Fix a compiler-problem when using PCH - the /Ym flag is adjusted by the compiler in MSVC2012, hence we need to set an upper limit to avoid disrupancies) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm500") +# Specify the maximum PreCompiled Header memory allocation limit +# Fixes a compiler-problem when using PCH - the /Ym flag is adjusted by the compiler in MSVC2012, hence we need to set an upper limit with /Zm to avoid disrupancies) +# (And yes, this is a verified , unresolved bug with MSVC... *sigh*) +string(REPLACE "/Zm1000" "/Zm500" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) From 4186c3cef7cf53051f52d56e9b4ffb84c5502a03 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 31 Dec 2012 14:10:22 +0100 Subject: [PATCH 4/5] Buildsystem/MSVC: Enable and treat as errors compilation warning about not matching virtual function signatures. This will help scripters who might sometimes use a hook using improper parameters (or miss 'const' for example) --- cmake/compiler/msvc/settings.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/compiler/msvc/settings.cmake b/cmake/compiler/msvc/settings.cmake index d816a31405d..d758d466407 100644 --- a/cmake/compiler/msvc/settings.cmake +++ b/cmake/compiler/msvc/settings.cmake @@ -55,3 +55,8 @@ endif() # Fixes a compiler-problem when using PCH - the /Ym flag is adjusted by the compiler in MSVC2012, hence we need to set an upper limit with /Zm to avoid disrupancies) # (And yes, this is a verified , unresolved bug with MSVC... *sigh*) string(REPLACE "/Zm1000" "/Zm500" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + +# Enable and treat as errors the following warnings to easily detect virtual function signature failures: +# 'function' : member function does not override any base class virtual member function +# 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /we4263 /we4264") From edb90f957baa9d9bb83f4477954593117e9fa858 Mon Sep 17 00:00:00 2001 From: Gacko Date: Mon, 31 Dec 2012 15:03:19 +0100 Subject: [PATCH 5/5] Core/DB: Haaleshi Altar - Prevent crash due to spamming GossipHello - Convert core script to SAI - Solves #8220 --- sql/updates/world/2012_12_31_01_world_sai.sql | 13 ++++++++++++ .../scripts/Outland/hellfire_peninsula.cpp | 21 +------------------ 2 files changed, 14 insertions(+), 20 deletions(-) create mode 100644 sql/updates/world/2012_12_31_01_world_sai.sql diff --git a/sql/updates/world/2012_12_31_01_world_sai.sql b/sql/updates/world/2012_12_31_01_world_sai.sql new file mode 100644 index 00000000000..96cf4d1e724 --- /dev/null +++ b/sql/updates/world/2012_12_31_01_world_sai.sql @@ -0,0 +1,13 @@ +-- Assign SmartGameObjectAI +UPDATE `gameobject_template` SET `AIName`='SmartGameObjectAI',`ScriptName`='' WHERE `entry`=181606; + +-- SmartGameObjectAI for summoning Aeranas at Haaleshi Altar +DELETE FROM `smart_scripts` WHERE `entryorguid`=181606 AND `source_type`=1; +INSERT INTO `smart_scripts`(`entryorguid`,`source_type`,`id`,`event_type`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`target_type`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(181606,1,0,64,12,17085,4,60000,8,-1321.79,4043.8,116.24,1.25,'Haaleshi Altar - On gossip hello - Summon Aeranas'); + +-- Aeranas should only be summonened if there is not already one in range +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceEntry`=181606 AND `SourceId`=1; +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`NegativeCondition`,`Comment`) VALUES +(22,1,181606,1,29,1,17085,50,1,'Haaleshi Altar - Only summon Aeranas if there is not already one in range'), +(22,1,181606,1,28,0,9418,0,0,'Haaleshi Altar - Only summon Aeranas if invoker has completed quest Avruus Orb (Is auto-completed)'); diff --git a/src/server/scripts/Outland/hellfire_peninsula.cpp b/src/server/scripts/Outland/hellfire_peninsula.cpp index 7ac90320347..24d00235ab8 100644 --- a/src/server/scripts/Outland/hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/hellfire_peninsula.cpp @@ -53,9 +53,7 @@ enum eAeranas FACTION_FRIENDLY = 35, SPELL_ENVELOPING_WINDS = 15535, - SPELL_SHOCK = 12553, - - C_AERANAS = 17085 + SPELL_SHOCK = 12553 }; class npc_aeranas : public CreatureScript @@ -204,22 +202,6 @@ public: }; }; -/*###### -## go_haaleshi_altar -######*/ - -class go_haaleshi_altar : public GameObjectScript -{ -public: - go_haaleshi_altar() : GameObjectScript("go_haaleshi_altar") { } - - bool OnGossipHello(Player* /*player*/, GameObject* go) - { - go->SummonCreature(C_AERANAS, -1321.79f, 4043.80f, 116.24f, 1.25f, TEMPSUMMON_TIMED_DESPAWN, 180000); - return false; - } -}; - /*###### ## npc_naladu ######*/ @@ -532,7 +514,6 @@ void AddSC_hellfire_peninsula() { new npc_aeranas(); new npc_ancestral_wolf(); - new go_haaleshi_altar(); new npc_naladu(); new npc_tracy_proudwell(); new npc_trollbane();