aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts')
-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
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp27
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp17
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp60
-rwxr-xr-xsrc/server/scripts/World/achievement_scripts.cpp32
7 files changed, 125 insertions, 57 deletions
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/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 90abf2073ee..260b0c57563 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -1373,9 +1373,9 @@ 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
+ class spell_gen_damage_reduction_AuraScript : public AuraScript
{
- PrepareAuraScript(spell_gen_damage_reduction_auraScript);
+ PrepareAuraScript(spell_gen_damage_reduction_AuraScript);
bool Validate(SpellInfo const* /*SpellEntry*/)
{
@@ -1387,19 +1387,16 @@ public:
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
- if (!target || target->HasAura(SPELL_DAMAGE_REDUCTION_AURA))
- return;
-
target->CastSpell(target, SPELL_DAMAGE_REDUCTION_AURA, true);
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
- if (!target || !target->HasAura(SPELL_DAMAGE_REDUCTION_AURA))
+ if (!target->HasAura(SPELL_DAMAGE_REDUCTION_AURA))
return;
- if (target->HasAura(SPELL_BLESSING_OF_SANCTUARY) ||
+ if (target->HasAura(SPELL_BLESSING_OF_SANCTUARY) ||
target->HasAura(SPELL_GREATER_BLESSING_OF_SANCTUARY) ||
target->HasAura(SPELL_RENEWED_HOPE) ||
target->HasAura(SPELL_VIGILANCE))
@@ -1410,15 +1407,15 @@ public:
void Register()
{
- OnEffectApply += AuraEffectApplyFn(spell_gen_damage_reduction_auraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
- OnEffectRemove += AuraEffectRemoveFn(spell_gen_damage_reduction_auraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ 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();
+ return new spell_gen_damage_reduction_AuraScript();
}
};
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();