aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/2011_11_26_01_world_quest_template.sql2
-rw-r--r--sql/updates/world/2011_11_26_05_world_ulduar_gameobject.sql (renamed from sql/updates/world/2011_11_26_05_ulduar_gameobject.sql)0
-rw-r--r--sql/updates/world/2011_11_26_06_world_sai.sql18
-rw-r--r--sql/updates/world/2011_11_27_00_world_creature_template.sql4
-rw-r--r--sql/updates/world/2011_11_27_00_world_spell_script.sql6
-rw-r--r--sql/updates/world/2011_11_28_00_world_achievement_criteria_data.sql3
-rw-r--r--sql/updates/world/2011_11_29_00_world_spell_script.sql4
-rw-r--r--sql/updates/world/2011_12_03_00_world_gameobject.sql4
-rw-r--r--src/server/collision/Maps/TileAssembler.cpp2
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.cpp13
-rwxr-xr-xsrc/server/game/Chat/Commands/Level2.cpp4
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.cpp4
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.h3
-rwxr-xr-xsrc/server/game/Entities/Creature/GossipDef.cpp2
-rwxr-xr-xsrc/server/game/Entities/DynamicObject/DynamicObject.cpp8
-rwxr-xr-xsrc/server/game/Entities/DynamicObject/DynamicObject.h2
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp5
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.h3
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp16
-rwxr-xr-xsrc/server/game/Entities/Transport/Transport.cpp2
-rwxr-xr-xsrc/server/game/Events/GameEventMgr.cpp7
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp19
-rwxr-xr-xsrc/server/game/Maps/Map.cpp22
-rwxr-xr-xsrc/server/game/Maps/Map.h2
-rwxr-xr-xsrc/server/game/Pools/PoolMgr.cpp6
-rwxr-xr-xsrc/server/game/Quests/QuestDef.cpp4
-rwxr-xr-xsrc/server/game/Quests/QuestDef.h2
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp9
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp4
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp9
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp33
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp24
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp27
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp61
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp60
-rwxr-xr-xsrc/server/scripts/World/achievement_scripts.cpp32
37 files changed, 308 insertions, 120 deletions
diff --git a/sql/updates/world/2011_11_26_01_world_quest_template.sql b/sql/updates/world/2011_11_26_01_world_quest_template.sql
index 44548ec9981..5b08d57860b 100644
--- a/sql/updates/world/2011_11_26_01_world_quest_template.sql
+++ b/sql/updates/world/2011_11_26_01_world_quest_template.sql
@@ -1 +1 @@
-UPDATE `quest_template` SET `RequiredRaces`=0 WHERE `entry`=14171;
+UPDATE `quest_template` SET `RequiredRaces`=0 WHERE `Id`=14171;
diff --git a/sql/updates/world/2011_11_26_05_ulduar_gameobject.sql b/sql/updates/world/2011_11_26_05_world_ulduar_gameobject.sql
index 60ba0aefbeb..60ba0aefbeb 100644
--- a/sql/updates/world/2011_11_26_05_ulduar_gameobject.sql
+++ b/sql/updates/world/2011_11_26_05_world_ulduar_gameobject.sql
diff --git a/sql/updates/world/2011_11_26_06_world_sai.sql b/sql/updates/world/2011_11_26_06_world_sai.sql
new file mode 100644
index 00000000000..9396222e8be
--- /dev/null
+++ b/sql/updates/world/2011_11_26_06_world_sai.sql
@@ -0,0 +1,18 @@
+-- [Q] [H] Teron Gorefiend, I am...
+-- Ancient Shadowmoon Spirit SAI
+SET @ENTRY := 21797;
+SET @QUEST := 10639;
+UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY;
+UPDATE `quest_template` SET `StartScript`=0,`CompleteScript`=0 WHERE `Id`=@QUEST;
+DELETE FROM `quest_start_scripts` WHERE `id`=@QUEST;
+DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY;
+DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100);
+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
+(@ENTRY,0,0,0,19,0,100,0,@QUEST,0,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Ancient Shadowmoon Spirit - On Quest Accept - Run Script"),
+(@ENTRY*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,"Ancient Shadowmoon Spirit - On Script - Say Line 0"),
+(@ENTRY*100,9,1,0,0,0,100,0,5000,5000,0,0,12,21877,1,300000,0,0,0,8,0,0,0,-4536.58,1028.76,8.8266,3.72963,"Ancient Shadowmoon Spirit - On Script - Summon Karsius the Ancient Watcher");
+-- Text
+DELETE FROM `db_script_string` WHERE `entry`=2000000031;
+DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(@ENTRY,0,0,"Your body is mine! Our fates are forever intertwined!",14,0,100,0,0,0,"Ancient Shadowmoon Spirit");
diff --git a/sql/updates/world/2011_11_27_00_world_creature_template.sql b/sql/updates/world/2011_11_27_00_world_creature_template.sql
new file mode 100644
index 00000000000..f29586ea142
--- /dev/null
+++ b/sql/updates/world/2011_11_27_00_world_creature_template.sql
@@ -0,0 +1,4 @@
+UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=150 WHERE `entry`=36597; -- The Lich King 10N
+UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=180 WHERE `entry`=39166; -- The Lich King 25N
+UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=180 WHERE `entry`=39167; -- The Lich King 10H
+UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=225 WHERE `entry`=39168; -- The Lich King 25H
diff --git a/sql/updates/world/2011_11_27_00_world_spell_script.sql b/sql/updates/world/2011_11_27_00_world_spell_script.sql
new file mode 100644
index 00000000000..5411d660c2b
--- /dev/null
+++ b/sql/updates/world/2011_11_27_00_world_spell_script.sql
@@ -0,0 +1,6 @@
+DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_gen_damage_reduction_aura';
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
+(20911,'spell_gen_damage_reduction_aura'), -- Blessing of Sanctuary
+(25899,'spell_gen_damage_reduction_aura'), -- Greater Blessing of Sanctuary
+(63944,'spell_gen_damage_reduction_aura'), -- Renewed Hope
+(50720,'spell_gen_damage_reduction_aura'); -- Vigilance
diff --git a/sql/updates/world/2011_11_28_00_world_achievement_criteria_data.sql b/sql/updates/world/2011_11_28_00_world_achievement_criteria_data.sql
new file mode 100644
index 00000000000..9fea807a97c
--- /dev/null
+++ b/sql/updates/world/2011_11_28_00_world_achievement_criteria_data.sql
@@ -0,0 +1,3 @@
+DELETE FROM achievement_criteria_data WHERE criteria_id = 3693;
+INSERT INTO achievement_criteria_data VALUES
+(3693, 11, 0, 0, 'achievement_bg_control_all_nodes');
diff --git a/sql/updates/world/2011_11_29_00_world_spell_script.sql b/sql/updates/world/2011_11_29_00_world_spell_script.sql
new file mode 100644
index 00000000000..ff87ebff788
--- /dev/null
+++ b/sql/updates/world/2011_11_29_00_world_spell_script.sql
@@ -0,0 +1,4 @@
+DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_gen_damage_reduction_aura' AND `spell_id`=50720;
+DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_warr_vigilance';
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
+(50720,'spell_warr_vigilance'); -- Vigilance
diff --git a/sql/updates/world/2011_12_03_00_world_gameobject.sql b/sql/updates/world/2011_12_03_00_world_gameobject.sql
new file mode 100644
index 00000000000..5707ee28d12
--- /dev/null
+++ b/sql/updates/world/2011_12_03_00_world_gameobject.sql
@@ -0,0 +1,4 @@
+DELETE FROM `gameobject` WHERE `guid` IN (207,215) AND `id`=300245; -- TEMP Forgemaster''s Anvil
+INSERT INTO `gameobject` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) VALUES
+(207, 300245, 658, 3, 1, 637.954, -209.544, 533.269, 3.53903, 0, 0, 0.980321, -0.197413, 300, 0, 1),
+(215, 300245, 658, 3, 1, 726.268, -237.654, 534.13, 5.5732, 0, 0, 0.347582, -0.93765, 300, 0, 1);
diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp
index 533a7ca825c..55051fda4bb 100644
--- a/src/server/collision/Maps/TileAssembler.cpp
+++ b/src/server/collision/Maps/TileAssembler.cpp
@@ -500,7 +500,7 @@ namespace VMAP
{
model.setGroupModels(groupsArray);
- std::string worldModelFileName(iSrcDir);
+ std::string worldModelFileName(iDestDir);
worldModelFileName.push_back('/');
worldModelFileName.append(pModelFilename).append(".vmo");
success = model.writeFile(worldModelFileName);
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index af350ac39d6..4ad00f5d7aa 100755
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -1454,7 +1454,11 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
data.go_state = 1;
*/
// Add to world, so it can be later looked up from HashMapHolder
- map->AddToMap(go);
+ if (!map->AddToMap(go))
+ {
+ delete go;
+ return false;
+ }
m_BgObjects[type] = go->GetGUID();
return true;
}
@@ -1557,7 +1561,12 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
creature->SetSpeed(MOVE_WALK, cinfo->speed_walk);
creature->SetSpeed(MOVE_RUN, cinfo->speed_run);
- map->AddToMap(creature);
+ if (!map->AddToMap(creature))
+ {
+ delete creature;
+ return NULL;
+ }
+
m_BgCreatures[type] = creature->GetGUID();
if (respawntime)
diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp
index 1dd603094f6..41bc564759c 100755
--- a/src/server/game/Chat/Commands/Level2.cpp
+++ b/src/server/game/Chat/Commands/Level2.cpp
@@ -861,10 +861,6 @@ bool ChatHandler::HandleCreatePetCommand(const char* /*args*/)
// Everything looks OK, create new pet
Pet* pet = new Pet(player, HUNTER_PET);
-
- if (!pet)
- return false;
-
if (!pet->CreateBaseAtCreature(creatureTarget))
{
delete pet;
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 922db88bcd0..3238d9873a9 100755
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -1241,7 +1241,7 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint3
return true;
}
-bool Creature::LoadFromDB(uint32 guid, Map* map)
+bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap)
{
CreatureData const* data = sObjectMgr->GetCreatureData(guid);
@@ -1310,6 +1310,8 @@ bool Creature::LoadFromDB(uint32 guid, Map* map)
m_creatureData = data;
+ if (addToMap && !GetMap()->AddToMap(this))
+ return false;
return true;
}
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 665942e134a..6ae9fa97462 100755
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -575,7 +575,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
void setDeathState(DeathState s); // override virtual Unit::setDeathState
bool FallGround();
- bool LoadFromDB(uint32 guid, Map* map);
+ bool LoadFromDB(uint32 guid, Map* map) { return LoadCreatureFromDB(guid, map, false); }
+ bool LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap = true);
void SaveToDB();
// overriden in Pet
virtual void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index 5bf7910466c..398deb04723 100755
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
@@ -516,7 +516,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
data << uint32(quest->RequiredNpcOrGo[i]);
data << uint32(quest->RequiredNpcOrGoCount[i]);
- data << uint32(quest->RequiredSourceItemid[i]);
+ data << uint32(quest->RequiredSourceItemId[i]);
data << uint32(0); // req source count?
}
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
index 4fc463e6e88..30afd43cf14 100755
--- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
@@ -79,7 +79,7 @@ void DynamicObject::RemoveFromWorld()
}
}
-bool DynamicObject::Create(uint32 guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, bool active, DynamicObjectType type)
+bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, bool active, DynamicObjectType type)
{
SetMap(caster->GetMap());
Relocate(pos);
@@ -106,6 +106,12 @@ bool DynamicObject::Create(uint32 guidlow, Unit* caster, uint32 spellId, Positio
SetUInt32Value(DYNAMICOBJECT_CASTTIME, getMSTime());
m_isWorldObject = active;
+ if (active)
+ setActive(true); //must before add to map to be put in world container
+
+ if (!GetMap()->AddToMap(this))
+ return false;
+
return true;
}
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h
index 419aaf9e83b..c178fe98d14 100755
--- a/src/server/game/Entities/DynamicObject/DynamicObject.h
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.h
@@ -41,7 +41,7 @@ class DynamicObject : public WorldObject, public GridObject<DynamicObject>
void AddToWorld();
void RemoveFromWorld();
- bool Create(uint32 guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, bool active, DynamicObjectType type);
+ bool CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, bool active, DynamicObjectType type);
void Update(uint32 p_time);
void Remove();
void SetDuration(int32 newDuration);
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 9e514ad34bb..de1b0f84871 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -695,7 +695,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
WorldDatabase.CommitTransaction(trans);
}
-bool GameObject::LoadFromDB(uint32 guid, Map* map)
+bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
{
GameObjectData const* data = sObjectMgr->GetGOData(guid);
@@ -760,6 +760,9 @@ bool GameObject::LoadFromDB(uint32 guid, Map* map)
m_goData = data;
+ if (addToMap && !GetMap()->AddToMap(this))
+ return false;
+
return true;
}
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 9167b40d285..c47587177c8 100755
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -648,7 +648,8 @@ class GameObject : public WorldObject, public GridObject<GameObject>
void SaveToDB();
void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
- bool LoadFromDB(uint32 guid, Map* map);
+ bool LoadFromDB(uint32 guid, Map* map) { return LoadGameObjectFromDB(guid, map, false); }
+ bool LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap = true);
void DeleteFromDB();
void SetOwnerGUID(uint64 owner)
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 401e965f816..d32980bf72d 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -14855,10 +14855,10 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
{
- if (quest->RequiredSourceItemid[i])
+ if (quest->RequiredSourceItemId[i])
{
- uint32 count = quest->RequiredSourceItemId[i];
- DestroyItemCount(quest->RequiredSourceItemid[i], count ? count : 9999, true);
+ uint32 count = quest->RequiredSourceItemIdCount[i];
+ DestroyItemCount(quest->RequiredSourceItemId[i], count ? count : 9999, true);
}
}
@@ -15055,9 +15055,9 @@ void Player::FailQuest(uint32 questId)
// Destroy items recieved on starting the quest.
DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true, true);
for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
- if (quest->RequiredSourceItemid[i] > 0 && quest->RequiredSourceItemId[i] > 0)
+ if (quest->RequiredSourceItemId[i] > 0 && quest->RequiredSourceItemIdCount[i] > 0)
// Destroy items recieved during the quest.
- DestroyItemCount(quest->RequiredSourceItemid[i], quest->RequiredSourceItemId[i], true, true);
+ DestroyItemCount(quest->RequiredSourceItemId[i], quest->RequiredSourceItemIdCount[i], true, true);
}
}
@@ -16108,7 +16108,7 @@ bool Player::HasQuestForItem(uint32 itemid) const
for (uint8 j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j)
{
// examined item is a source item
- if (qinfo->RequiredSourceItemid[j] == itemid)
+ if (qinfo->RequiredSourceItemId[j] == itemid)
{
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemid);
@@ -16117,9 +16117,9 @@ bool Player::HasQuestForItem(uint32 itemid) const
return true;
// allows custom amount drop when not 0
- if (qinfo->RequiredSourceItemId[j])
+ if (qinfo->RequiredSourceItemIdCount[j])
{
- if (GetItemCount(itemid, true) < qinfo->RequiredSourceItemId[j])
+ if (GetItemCount(itemid, true) < qinfo->RequiredSourceItemIdCount[j])
return true;
} else if (GetItemCount(itemid, true) < pProto->GetMaxStackSize())
return true;
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 97f5af1c6e9..008f752306d 100755
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -664,9 +664,9 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y,
return 0;
}
- creature->m_isWorldObject = true; //so it will not be unloaded with grid
map->AddToMap(creature);
m_NPCPassengerSet.insert(creature);
+ creature->SetWorldObject(true); //so it will not be unloaded with grid
if (tguid == 0)
{
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index dbcb07e88f5..d3cc27c9e6c 100755
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -1176,10 +1176,8 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
{
Creature* creature = new Creature;
//sLog->outDebug("Spawning creature %u", *itr);
- if (!creature->LoadFromDB(*itr, map))
+ if (!creature->LoadCreatureFromDB(*itr, map))
delete creature;
- else
- map->AddToMap(creature);
}
}
}
@@ -1205,7 +1203,8 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
{
GameObject* pGameobject = new GameObject;
//sLog->outDebug("Spawning gameobject %u", *itr);
- if (!pGameobject->LoadFromDB(*itr, map))
+ //TODO: find out when it is add to map
+ if (!pGameobject->LoadGameObjectFromDB(*itr, map, false))
delete pGameobject;
else
{
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 6b0601d9663..294e83deeaa 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -1630,13 +1630,12 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float
if (!map->Instanceable() && map->IsGridLoaded(x, y))
{
GameObject* go = new GameObject;
- if (!go->LoadFromDB(guid, map))
+ if (!go->LoadGameObjectFromDB(guid, map))
{
sLog->outError("AddGOData: cannot add gameobject entry %u to map", entry);
delete go;
return 0;
}
- map->AddToMap(go);
}
sLog->outDebug(LOG_FILTER_MAPS, "AddGOData: dbguid %u entry %u map %u x %f y %f z %f o %f", guid, entry, mapId, x, y, z, o);
@@ -1666,13 +1665,12 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos)
if (!map->Instanceable() && map->IsGridLoaded(data.posX, data.posY))
{
Creature* creature = new Creature;
- if (!creature->LoadFromDB(guid, map))
+ if (!creature->LoadCreatureFromDB(guid, map))
{
sLog->outError("AddCreature: cannot add creature entry %u to map", guid);
delete creature;
return false;
}
- map->AddToMap(creature);
}
}
return true;
@@ -1719,13 +1717,12 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float
if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
{
Creature* creature = new Creature;
- if (!creature->LoadFromDB(guid, map))
+ if (!creature->LoadCreatureFromDB(guid, map))
{
sLog->outError("AddCreature: cannot add creature entry %u to map", entry);
delete creature;
return 0;
}
- map->AddToMap(creature);
}
}
@@ -4027,22 +4024,22 @@ void ObjectMgr::LoadQuests()
for (uint8 j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j)
{
- uint32 id = qinfo->RequiredSourceItemid[j];
+ uint32 id = qinfo->RequiredSourceItemId[j];
if (id)
{
if (!sObjectMgr->GetItemTemplate(id))
{
- sLog->outErrorDb("Quest %u has `RequiredSourceItemid%d` = %u but item with entry %u does not exist, quest can't be done.",
+ sLog->outErrorDb("Quest %u has `RequiredSourceItemId%d` = %u but item with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(), j+1, id, id);
// no changes, quest can't be done for this requirement
}
}
else
{
- if (qinfo->RequiredSourceItemId[j]>0)
+ if (qinfo->RequiredSourceItemIdCount[j]>0)
{
- sLog->outErrorDb("Quest %u has `RequiredSourceItemid%d` = 0 but `RequiredSourceItemId%d` = %u.",
- qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredSourceItemId[j]);
+ sLog->outErrorDb("Quest %u has `RequiredSourceItemId%d` = 0 but `RequiredSourceItemIdCount%d` = %u.",
+ qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredSourceItemIdCount[j]);
// no changes, quest ignore this data
}
}
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index bd419482b5b..13a47633b53 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -415,21 +415,25 @@ void Map::InitializeObject(Creature* obj)
}
template<class T>
-void Map::AddToMap(T *obj)
+bool Map::AddToMap(T *obj)
{
//TODO: Needs clean up. An object should not be added to map twice.
if (obj->IsInWorld())
{
ASSERT(obj->IsInGrid());
obj->UpdateObjectVisibility(true);
- return;
+ return true;
}
CellCoord cellCoord = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
+ //It will create many problems (including crashes) if an object is not added to grid after creation
+ //The correct way to fix it is to make AddToMap return false and delete the object if it is not added to grid
+ //But now AddToMap is used in too many places, I will just see how many ASSERT failures it will cause
+ ASSERT(cellCoord.IsCoordValid());
if (!cellCoord.IsCoordValid())
{
sLog->outError("Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
- return;
+ return false; //Should delete object
}
Cell cell(cellCoord);
@@ -452,6 +456,7 @@ void Map::AddToMap(T *obj)
//something, such as vehicle, needs to be update immediately
//also, trigger needs to cast spell, if not update, cannot see visual
obj->UpdateObjectVisibility(true);
+ return true;
}
bool Map::IsGridLoaded(const GridCoord &p) const
@@ -660,8 +665,7 @@ void Map::RemovePlayerFromMap(Player* player, bool remove)
}
template<class T>
-void
-Map::RemoveFromMap(T *obj, bool remove)
+void Map::RemoveFromMap(T *obj, bool remove)
{
obj->RemoveFromWorld();
if (obj->isActiveObject())
@@ -2137,10 +2141,10 @@ void Map::RemoveFromActive(Creature* c)
}
}
-template void Map::AddToMap(Corpse*);
-template void Map::AddToMap(Creature*);
-template void Map::AddToMap(GameObject*);
-template void Map::AddToMap(DynamicObject*);
+template bool Map::AddToMap(Corpse*);
+template bool Map::AddToMap(Creature*);
+template bool Map::AddToMap(GameObject*);
+template bool Map::AddToMap(DynamicObject*);
template void Map::RemoveFromMap(Corpse*, bool);
template void Map::RemoveFromMap(Creature*, bool);
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index 9caef8457b8..5b652a2524a 100755
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -246,7 +246,7 @@ class Map : public GridRefManager<NGridType>
virtual bool AddPlayerToMap(Player*);
virtual void RemovePlayerFromMap(Player*, bool);
- template<class T> void AddToMap(T *);
+ template<class T> bool AddToMap(T *);
template<class T> void RemoveFromMap(T *, bool);
void VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer> &gridVisitor, TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer> &worldVisitor);
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index bd8840ff8a8..96bb4a211eb 100755
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -365,13 +365,11 @@ void PoolGroup<Creature>::Spawn1Object(PoolObject* obj)
{
Creature* creature = new Creature;
//sLog->outDebug(LOG_FILTER_POOLSYS, "Spawning creature %u", guid);
- if (!creature->LoadFromDB(obj->guid, map))
+ if (!creature->LoadCreatureFromDB(obj->guid, map))
{
delete creature;
return;
}
- else
- map->AddToMap(creature);
}
}
}
@@ -391,7 +389,7 @@ void PoolGroup<GameObject>::Spawn1Object(PoolObject* obj)
{
GameObject* pGameobject = new GameObject;
//sLog->outDebug(LOG_FILTER_POOLSYS, "Spawning gameobject %u", guid);
- if (!pGameobject->LoadFromDB(obj->guid, map))
+ if (!pGameobject->LoadGameObjectFromDB(obj->guid, map, false))
{
delete pGameobject;
return;
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp
index 29bd95a73a3..e6e95d90f5f 100755
--- a/src/server/game/Quests/QuestDef.cpp
+++ b/src/server/game/Quests/QuestDef.cpp
@@ -106,10 +106,10 @@ Quest::Quest(Field* questRecord)
RequiredNpcOrGoCount[i] = questRecord[93+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
- RequiredSourceItemid[i] = questRecord[97+i].GetUInt32();
+ RequiredSourceItemId[i] = questRecord[97+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
- RequiredSourceItemId[i] = questRecord[101+i].GetUInt32();
+ RequiredSourceItemIdCount[i] = questRecord[101+i].GetUInt32();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
RequiredItemId[i] = questRecord[105+i].GetUInt32();
diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h
index fc9a432a11b..8a34200ede2 100755
--- a/src/server/game/Quests/QuestDef.h
+++ b/src/server/game/Quests/QuestDef.h
@@ -262,8 +262,8 @@ class Quest
std::string ObjectiveText[QUEST_OBJECTIVES_COUNT];
uint32 RequiredItemId[QUEST_ITEM_OBJECTIVES_COUNT];
uint32 RequiredItemCount[QUEST_ITEM_OBJECTIVES_COUNT];
- uint32 RequiredSourceItemid[QUEST_SOURCE_ITEM_IDS_COUNT];
uint32 RequiredSourceItemId[QUEST_SOURCE_ITEM_IDS_COUNT];
+ uint32 RequiredSourceItemIdCount[QUEST_SOURCE_ITEM_IDS_COUNT];
int32 RequiredNpcOrGo[QUEST_OBJECTIVES_COUNT]; // >0 Creature <0 Gameobject
uint32 RequiredNpcOrGoCount[QUEST_OBJECTIVES_COUNT];
uint32 RequiredSpellCast[QUEST_OBJECTIVES_COUNT];
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index a4cf8e6a469..e42294f59ae 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -2589,14 +2589,12 @@ void Spell::EffectPersistentAA(SpellEffIndex effIndex)
if (!caster->IsInWorld())
return;
DynamicObject* dynObj = new DynamicObject();
- if (!dynObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo->Id, *m_targets.GetDst(), radius, false, DYNAMIC_OBJECT_AREA_SPELL))
+ if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo->Id, *m_targets.GetDst(), radius, false, DYNAMIC_OBJECT_AREA_SPELL))
{
delete dynObj;
return;
}
- dynObj->GetMap()->AddToMap(dynObj);
-
if (Aura* aura = Aura::TryCreate(m_spellInfo, MAX_EFFECT_MASK, dynObj, caster, &m_spellValue->EffectBasePoints[0]))
{
m_spellAura = aura;
@@ -3440,16 +3438,13 @@ void Spell::EffectAddFarsight(SpellEffIndex effIndex)
return;
DynamicObject* dynObj = new DynamicObject();
- if (!dynObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, *m_targets.GetDst(), radius, true, DYNAMIC_OBJECT_FARSIGHT_FOCUS))
+ if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, *m_targets.GetDst(), radius, true, DYNAMIC_OBJECT_FARSIGHT_FOCUS))
{
delete dynObj;
return;
}
dynObj->SetDuration(duration);
-
- dynObj->setActive(true); //must before add to map to be put in world container
- dynObj->GetMap()->AddToMap(dynObj); //grid will also be loaded
dynObj->SetCasterViewpoint();
}
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index 4c9960992e1..eb1ccc543f3 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -165,14 +165,12 @@ public:
object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), player->GetPhaseMaskForSpawn());
// this will generate a new guid if the object is in an instance
- if (!object->LoadFromDB(guidLow, map))
+ if (!object->LoadGameObjectFromDB(guidLow, map))
{
delete object;
return false;
}
- map->AddToMap(object);
-
// TODO: is it really necessary to add both the real and DB table guid here ?
sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow));
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 20d0994b911..b9ac21cc040 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -147,9 +147,12 @@ public:
uint32 db_guid = creature->GetDBTableGUIDLow();
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
- creature->LoadFromDB(db_guid, map);
+ if (!creature->LoadCreatureFromDB(db_guid, map))
+ {
+ delete creature;
+ return false;
+ }
- map->AddToMap(creature);
sObjectMgr->AddCreatureToGrid(db_guid, sObjectMgr->GetCreatureData(db_guid));
return true;
}
@@ -1123,7 +1126,7 @@ public:
}
// Everything looks OK, create new pet
- Pet* pet = player->CreateTamedPetFrom (creatureTarget);
+ Pet* pet = player->CreateTamedPetFrom(creatureTarget);
if (!pet)
{
handler->PSendSysMessage (LANG_CREATURE_NON_TAMEABLE, cInfo->Entry);
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index ebeb7b8f4f4..d34ee801e50 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -578,8 +578,13 @@ public:
wpCreature2->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
- wpCreature2->LoadFromDB(wpCreature2->GetDBTableGUIDLow(), map);
- map->AddToMap(wpCreature2);
+ //TODO: Should we first use "Create" then use "LoadFromDB"?
+ if (!wpCreature2->LoadCreatureFromDB(wpCreature2->GetDBTableGUIDLow(), map))
+ {
+ handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
+ delete wpCreature2;
+ return false;
+ }
//sMapMgr->GetMap(npcCreature->GetMapId())->Add(wpCreature2);
}
@@ -777,8 +782,12 @@ public:
wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
- wpCreature->LoadFromDB(wpCreature->GetDBTableGUIDLow(), map);
- map->AddToMap(wpCreature);
+ if (!wpCreature->LoadCreatureFromDB(wpCreature->GetDBTableGUIDLow(), map))
+ {
+ handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
+ delete wpCreature;
+ return false;
+ }
if (target)
{
@@ -824,8 +833,12 @@ public:
}
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
- creature->LoadFromDB(creature->GetDBTableGUIDLow(), map);
- map->AddToMap(creature);
+ if (!creature->LoadCreatureFromDB(creature->GetDBTableGUIDLow(), map))
+ {
+ handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
+ delete creature;
+ return false;
+ }
if (target)
{
@@ -872,8 +885,12 @@ public:
}
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
- creature->LoadFromDB(creature->GetDBTableGUIDLow(), map);
- map->AddToMap(creature);
+ if (!creature->LoadCreatureFromDB(creature->GetDBTableGUIDLow(), map))
+ {
+ handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id);
+ delete creature;
+ return false;
+ }
if (target)
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp
index 2fa19405153..b7b453caf60 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp
@@ -56,7 +56,7 @@ public:
break;
case GOSSIP_ACTION_INFO_DEF+11:
player->CLOSE_GOSSIP_MENU();
- creature->CastSpell(player, SPELL_LEARN_SMELT, false);
+ player->CastSpell(player, SPELL_LEARN_SMELT, false);
break;
case GOSSIP_ACTION_INFO_DEF+2:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEACH_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22);
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
index 282e6b3eb98..f28cd537e03 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
@@ -240,6 +240,8 @@ public:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
_cannotMove = true;
+
+ me->SetFlying(true);
}
uint32 GetData(uint32 data)
@@ -351,6 +353,8 @@ public:
_EnterCombat();
me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
+ me->SetFlying(false);
+
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Talk(SAY_AGGRO_P_ONE);
@@ -404,6 +408,7 @@ public:
void PrepareForVortex()
{
me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
+ me->SetFlying(true);
me->GetMotionMaster()->MovementExpired();
me->GetMotionMaster()->MovePoint(MOVE_VORTEX, MalygosPositions[1].GetPositionX(), MalygosPositions[1].GetPositionY(), MalygosPositions[1].GetPositionZ());
@@ -439,6 +444,7 @@ public:
me->SetInCombatWithZone();
break;
case MOVE_CENTER_PLATFORM:
+ // Malygos is already flying here, there is no need to set it again.
_cannotMove = false;
// malygos will move into center of platform and then he does not chase dragons, he just turns to his current target.
me->GetMotionMaster()->MoveIdle();
@@ -451,22 +457,21 @@ public:
SetPhase(PHASE_TWO, true);
me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
+ me->SetFlying(true);
me->GetMotionMaster()->MoveIdle();
me->GetMotionMaster()->MovePoint(MOVE_DEEP_BREATH_ROTATION, MalygosPhaseTwoWaypoints[0]);
- Creature* summon = me->SummonCreature(NPC_HOVER_DISK_CASTER, HoverDiskWaypoints[MAX_HOVER_DISK_WAYPOINTS-1]);
- if (summon && summon->IsAIEnabled)
- summon->AI()->DoAction(ACTION_HOVER_DISK_START_WP_2);
- summon = me->SummonCreature(NPC_HOVER_DISK_CASTER, HoverDiskWaypoints[0]);
- if (summon && summon->IsAIEnabled)
- summon->AI()->DoAction(ACTION_HOVER_DISK_START_WP_1);
-
for (uint8 i = 0; i < 2; i++)
{
+ // Starting position. One starts from the first waypoint and another from the last.
+ uint8 pos = !i ? MAX_HOVER_DISK_WAYPOINTS-1 : 0;
+ if (Creature* summon = me->SummonCreature(NPC_HOVER_DISK_CASTER, HoverDiskWaypoints[pos]))
+ if (summon->IsAIEnabled)
+ summon->AI()->DoAction(ACTION_HOVER_DISK_START_WP_1+i);
+
// not sure about its position.
- summon = me->SummonCreature(NPC_HOVER_DISK_MELEE, HoverDiskWaypoints[0]);
- if (summon)
+ if (Creature* summon = me->SummonCreature(NPC_HOVER_DISK_MELEE, HoverDiskWaypoints[0]))
summon->SetInCombatWithZone();
}
}
@@ -695,6 +700,7 @@ class spell_malygos_vortex_visual : public SpellScriptLoader
malygos->SetInCombatWithZone();
malygos->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
+ malygos->SetFlying(false);
malygos->GetMotionMaster()->MoveChase(caster->getVictim());
malygos->RemoveAura(SPELL_VORTEX_1);
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
index 23477741ba1..bcdcc69181a 100755
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
@@ -166,11 +166,15 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY))
{
delete go;
+ return true;
}
- else
+
+ go->SetRespawnTime(0);
+
+ if (!map->AddToMap(go))
{
- go->SetRespawnTime(0);
- map->AddToMap(go);
+ delete go;
+ return true;
}
}
}
@@ -189,17 +193,22 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
Map* map = player->GetMap();
if (!map)
{
- delete go;
- return true;
- }
+ delete go;
+ return true;
+ }
+
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY))
{
delete go;
+ return true;
}
- else
+
+ go->SetRespawnTime(0);
+
+ if (!map->AddToMap(go))
{
- go->SetRespawnTime(0);
- map->AddToMap(go);
+ delete go;
+ return true;
}
}
}
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index f0b48a5ad90..260b0c57563 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -1359,6 +1359,66 @@ public:
}
};
+enum DamageReductionAura
+{
+ SPELL_BLESSING_OF_SANCTUARY = 20911,
+ SPELL_GREATER_BLESSING_OF_SANCTUARY = 25899,
+ SPELL_RENEWED_HOPE = 63944,
+ SPELL_VIGILANCE = 50720,
+ SPELL_DAMAGE_REDUCTION_AURA = 68066,
+};
+
+class spell_gen_damage_reduction_aura : public SpellScriptLoader
+{
+public:
+ spell_gen_damage_reduction_aura() : SpellScriptLoader("spell_gen_damage_reduction_aura") { }
+
+ class spell_gen_damage_reduction_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_damage_reduction_AuraScript);
+
+ bool Validate(SpellInfo const* /*SpellEntry*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_DAMAGE_REDUCTION_AURA))
+ return false;
+ return true;
+ }
+
+ void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ target->CastSpell(target, SPELL_DAMAGE_REDUCTION_AURA, true);
+ }
+
+ void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ if (!target->HasAura(SPELL_DAMAGE_REDUCTION_AURA))
+ return;
+
+ if (target->HasAura(SPELL_BLESSING_OF_SANCTUARY) ||
+ target->HasAura(SPELL_GREATER_BLESSING_OF_SANCTUARY) ||
+ target->HasAura(SPELL_RENEWED_HOPE) ||
+ target->HasAura(SPELL_VIGILANCE))
+ return;
+
+ target->RemoveAurasDueToSpell(SPELL_DAMAGE_REDUCTION_AURA);
+ }
+
+ void Register()
+ {
+ OnEffectApply += AuraEffectApplyFn(spell_gen_damage_reduction_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ OnEffectRemove += AuraEffectRemoveFn(spell_gen_damage_reduction_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ }
+
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_gen_damage_reduction_AuraScript();
+ }
+};
+
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -1390,4 +1450,5 @@ void AddSC_generic_spell_scripts()
new spell_gen_launch();
new spell_gen_vehicle_scaling();
new spell_gen_oracle_wolvar_reputation();
+ new spell_gen_damage_reduction_aura();
}
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index be6e1c49ee7..b9def701fca 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -89,8 +89,68 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader
}
};
+enum DamageReductionAura
+{
+ SPELL_BLESSING_OF_SANCTUARY = 20911,
+ SPELL_GREATER_BLESSING_OF_SANCTUARY = 25899,
+ SPELL_RENEWED_HOPE = 63944,
+ SPELL_DAMAGE_REDUCTION_AURA = 68066,
+};
+
+class spell_warr_vigilance : public SpellScriptLoader
+{
+public:
+ spell_warr_vigilance() : SpellScriptLoader("spell_warr_vigilance") { }
+
+ class spell_warr_vigilance_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warr_vigilance_AuraScript);
+
+ bool Validate(SpellInfo const* /*SpellEntry*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_DAMAGE_REDUCTION_AURA))
+ return false;
+ return true;
+ }
+
+ void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ target->CastSpell(target, SPELL_DAMAGE_REDUCTION_AURA, true);
+ }
+
+ void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+
+ if (!target->HasAura(SPELL_DAMAGE_REDUCTION_AURA))
+ return;
+
+ if (target->HasAura(SPELL_BLESSING_OF_SANCTUARY) ||
+ target->HasAura(SPELL_GREATER_BLESSING_OF_SANCTUARY) ||
+ target->HasAura(SPELL_RENEWED_HOPE))
+ return;
+
+ target->RemoveAurasDueToSpell(SPELL_DAMAGE_REDUCTION_AURA);
+ }
+
+ void Register()
+ {
+ OnEffectApply += AuraEffectApplyFn(spell_warr_vigilance_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ OnEffectRemove += AuraEffectRemoveFn(spell_warr_vigilance_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ }
+
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warr_vigilance_AuraScript();
+ }
+};
+
void AddSC_warrior_spell_scripts()
{
new spell_warr_last_stand();
new spell_warr_improved_spell_reflection();
+ new spell_warr_vigilance();
}
diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp
index 2dbbd949526..29cb6c082a2 100755
--- a/src/server/scripts/World/achievement_scripts.cpp
+++ b/src/server/scripts/World/achievement_scripts.cpp
@@ -24,24 +24,6 @@
#include "BattlegroundAV.h"
#include "Vehicle.h"
-class achievement_storm_glory : public AchievementCriteriaScript
-{
- public:
- achievement_storm_glory() : AchievementCriteriaScript("achievement_storm_glory") { }
-
- bool OnCheck(Player* source, Unit* /*target*/)
- {
- if (source->GetBattlegroundTypeId() != BATTLEGROUND_EY)
- return false;
-
- Battleground* pEotS = source->GetBattleground();
- if (!pEotS)
- return false;
-
- return pEotS->IsAllNodesConrolledByTeam(source->GetTeam());
- }
-};
-
class achievement_resilient_victory : public AchievementCriteriaScript
{
public:
@@ -93,11 +75,14 @@ class achievement_save_the_day : public AchievementCriteriaScript
if (Player const* player = target->ToPlayer())
{
- if (source->GetBattlegroundTypeId() != BATTLEGROUND_WS || !source->GetBattleground())
+ Battleground* bg = source->GetBattleground();
+ if (!bg)
+ return false;
+
+ if (bg->GetTypeID(true) != BATTLEGROUND_WS)
return false;
- BattlegroundWS* pWSG = static_cast<BattlegroundWS*>(source->GetBattleground());
- if (pWSG->GetFlagState(player->GetTeam()) == BG_WS_FLAG_STATE_ON_BASE)
+ if (static_cast<BattlegroundWS*>(bg)->GetFlagState(player->GetTeam()) == BG_WS_FLAG_STATE_ON_BASE)
return true;
}
return false;
@@ -219,7 +204,7 @@ class achievement_everything_counts : public AchievementCriteriaScript
if (!bg)
return false;
- if (source->GetBattlegroundTypeId() != BATTLEGROUND_AV)
+ if (bg->GetTypeID(true) != BATTLEGROUND_AV)
return false;
if (static_cast<BattlegroundAV*>(bg)->IsBothMinesControlledByTeam(source->GetTeam()))
@@ -240,7 +225,7 @@ class achievement_bg_av_perfection : public AchievementCriteriaScript
if (!bg)
return false;
- if (source->GetBattlegroundTypeId() != BATTLEGROUND_AV)
+ if (bg->GetTypeID(true) != BATTLEGROUND_AV)
return false;
if (static_cast<BattlegroundAV*>(bg)->IsAllTowersControlledAndCaptainAlive(source->GetTeam()))
@@ -302,7 +287,6 @@ class achievement_bg_sa_defense_of_ancients : public AchievementCriteriaScript
void AddSC_achievement_scripts()
{
- new achievement_storm_glory();
new achievement_resilient_victory();
new achievement_bg_control_all_nodes();
new achievement_save_the_day();