Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.x

Conflicts:
	src/server/game/Entities/Creature/GossipDef.cpp
	src/server/game/Globals/ObjectMgr.cpp
	src/server/game/Quests/QuestDef.cpp
This commit is contained in:
Machiavelli
2011-12-06 12:01:51 +01:00
27 changed files with 204 additions and 109 deletions

View File

@@ -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));

View File

@@ -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);

View File

@@ -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)
{

View File

@@ -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;
}
}
}

View File

@@ -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();
}
};

View File

@@ -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();
}

View File

@@ -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;
BattlegroundWS* pWSG = static_cast<BattlegroundWS*>(source->GetBattleground());
if (pWSG->GetFlagState(player->GetTeam()) == BG_WS_FLAG_STATE_ON_BASE)
if (bg->GetTypeID(true) != BATTLEGROUND_WS)
return false;
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();