Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-01-04 19:22:20 +08:00
57 changed files with 1900 additions and 551 deletions

View File

@@ -290,10 +290,9 @@ public:
stmt->SetData(0, uint16(atLogin));
CharacterDatabase.Execute(stmt);
std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType const& plist = ObjectAccessor::GetPlayers();
for (auto itr = plist.begin(); itr != plist.end(); ++itr)
itr->second->SetAtLoginFlag(atLogin);
sWorld->DoForAllOnlinePlayers([&] (Player* player){
player->SetAtLoginFlag(atLogin);
});
return true;
}

View File

@@ -23,13 +23,11 @@
#include "GridNotifiers.h"
#include "InstanceMapScript.h"
#include "InstanceScript.h"
#include "ObjectDefines.h"
#include "ObjectMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "blackrock_spire.h"
#include "GridNotifiersImpl.h"
uint32 const DragonspireMobs[3] = { NPC_BLACKHAND_DREADWEAVER, NPC_BLACKHAND_SUMMONER, NPC_BLACKHAND_VETERAN };

View File

@@ -15,7 +15,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Containers.h"
#include "CreatureScript.h"
#include "ObjectAccessor.h"
#include "ScriptedCreature.h"

View File

@@ -46,17 +46,17 @@ public:
case GO_DOOR_LEVER_2:
case GO_DOOR_LEVER_3:
case GO_CANNON:
gameobject->UpdateSaveToDb(true);
gameobject->AllowSaveToDB(true);
break;
case GO_FACTORY_DOOR:
gameobject->UpdateSaveToDb(true);
gameobject->AllowSaveToDB(true);
// GoState (Door opened) is restored during GO creation, but we need to set LootState to prevent Lever from closing it again
if (_encounters[TYPE_RHAHK_ZOR] == DONE)
gameobject->SetLootState(GO_ACTIVATED);
break;
case GO_IRON_CLAD_DOOR:
gameobject->UpdateSaveToDb(true);
if (gameobject->GetStateSavedOnInstance() == GO_STATE_ACTIVE)
gameobject->AllowSaveToDB(true);
if (GetStoredGameObjectState(gameobject->GetSpawnId()) == GO_STATE_ACTIVE)
{
gameobject->DespawnOrUnsummon();
}

View File

@@ -62,7 +62,7 @@ public:
case GO_CAVE_IN_2:
case GO_WORKSHOP_DOOR:
case GO_FINAL_CHAMBER_DOOR:
gameobject->UpdateSaveToDb(true);
gameobject->AllowSaveToDB(true);
break;
}
}

View File

@@ -18,7 +18,6 @@
#include "SpellInfo.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "Unit.h"
class spell_q12779_an_end_to_all_things : public SpellScript
{

View File

@@ -538,7 +538,7 @@ public:
void DamageTaken(Unit* /*doneBy*/, uint32& damage, DamageEffectType, SpellSchoolMask) override
{
if (!canResurrectCheck && damage >= me->GetHealth())
if ((!canResurrectCheck || canResurrect) && damage >= me->GetHealth())
damage = me->GetHealth() - 1;
}

View File

@@ -65,7 +65,7 @@ public:
GateKirtonosGUID = go->GetGUID();
break;
case GO_DOOR_OPENED_WITH_KEY:
go->UpdateSaveToDb(true);
go->AllowSaveToDB(true);
break;
case GO_GATE_GANDLING_DOWN_NORTH:
GandlingGatesGUID[0] = go->GetGUID();

View File

@@ -178,69 +178,69 @@ public:
case GO_HALL_OF_HIGH_COMMAND:
case GO_GAUNTLET_DOOR_1:
case GO_GAUNTLET_DOOR_2:
go->UpdateSaveToDb(true);
go->AllowSaveToDB(true);
break;
case GO_ZIGGURAT_DOORS1:
go->UpdateSaveToDb(true);
go->AllowSaveToDB(true);
_zigguratDoorsGUID1 = go->GetGUID();
if (GetData(TYPE_ZIGGURAT1) >= 1)
go->SetGoState(GO_STATE_ACTIVE);
break;
case GO_ZIGGURAT_DOORS2:
go->UpdateSaveToDb(true);
go->AllowSaveToDB(true);
_zigguratDoorsGUID2 = go->GetGUID();
if (GetData(TYPE_ZIGGURAT2) >= 1)
go->SetGoState(GO_STATE_ACTIVE);
break;
case GO_ZIGGURAT_DOORS3:
go->UpdateSaveToDb(true);
go->AllowSaveToDB(true);
_zigguratDoorsGUID3 = go->GetGUID();
if (GetData(TYPE_ZIGGURAT3) >= 1)
go->SetGoState(GO_STATE_ACTIVE);
break;
case GO_GAUNTLET_GATE:
go->UpdateSaveToDb(true);
go->AllowSaveToDB(true);
_gauntletGateGUID = go->GetGUID();
if (_zigguratState1 == 2 && _zigguratState2 == 2 && _zigguratState3 == 2)
go->SetGoState(GO_STATE_ACTIVE);
break;
case GO_SLAUGTHER_GATE:
go->UpdateSaveToDb(true);
go->AllowSaveToDB(true);
_slaughterGateGUID = go->GetGUID();
if (_zigguratState1 == 2 && _zigguratState2 == 2 && _zigguratState3 == 2)
go->SetGoState(GO_STATE_ACTIVE);
break;
case GO_ZIGGURAT_DOORS4:
go->UpdateSaveToDb(true);
go->AllowSaveToDB(true);
_zigguratDoorsGUID4 = go->GetGUID();
if (_slaughterProgress == 4)
go->SetGoState(GO_STATE_ACTIVE);
break;
case GO_ZIGGURAT_DOORS5:
go->UpdateSaveToDb(true);
go->AllowSaveToDB(true);
_zigguratDoorsGUID5 = go->GetGUID();
if (_slaughterProgress == 4)
go->SetGoState(GO_STATE_ACTIVE);
break;
case GO_SLAUGHTER_GATE_SIDE:
go->UpdateSaveToDb(true);
go->AllowSaveToDB(true);
if (_slaughterProgress >= 2)
go->SetGoState(GO_STATE_ACTIVE);
break;
case GO_PORT_TRAP_GATE_1:
go->UpdateSaveToDb(true);
go->AllowSaveToDB(true);
_trapGatesGUIDs[0] = go->GetGUID();
break;
case GO_PORT_TRAP_GATE_2:
go->UpdateSaveToDb(true);
go->AllowSaveToDB(true);
_trapGatesGUIDs[1] = go->GetGUID();
break;
case GO_PORT_TRAP_GATE_3:
go->UpdateSaveToDb(true);
go->AllowSaveToDB(true);
_trapGatesGUIDs[2] = go->GetGUID();
break;
case GO_PORT_TRAP_GATE_4:
go->UpdateSaveToDb(true);
go->AllowSaveToDB(true);
_trapGatesGUIDs[3] = go->GetGUID();
break;
}

View File

@@ -23,7 +23,6 @@
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "TaskScheduler.h"
#include "WaypointMgr.h"
#include "zulgurub.h"
enum Says

View File

@@ -20,7 +20,6 @@ Blasted_Lands
Quest support: 3628. Teleporter to Rise of the Defiler.
*/
#include "CreatureScript.h"
#include "Group.h"
#include "Player.h"
#include "ScriptedCreature.h"

View File

@@ -18,7 +18,6 @@
#include "CreatureScript.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
/*######
## NPC 9836: Maredis Firestar

View File

@@ -20,7 +20,6 @@
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
/*######
## npc_ranger_lilatha

View File

@@ -1014,44 +1014,29 @@ class spell_midsummer_fling_torch : public SpellScript
bool handled;
bool Load() override { handled = false; return true; }
SpellCastResult CheckCast()
{
GetCaster()->GetCreaturesWithEntryInRange(_crList, 100.0f, NPC_TORCH_TARGET);
if (_crList.empty())
{
return SPELL_FAILED_NOT_HERE;
}
return SPELL_CAST_OK;
}
void ThrowNextTorch(Unit* caster)
{
uint8 rand = urand(0, _crList.size() - 1);
Position pos;
pos.Relocate(0.0f, 0.0f, 0.0f);
for (std::list<Creature*>::const_iterator itr = _crList.begin(); itr != _crList.end(); ++itr, --rand)
{
if (caster->GetDistance(*itr) < 5)
{
if (!rand)
rand++;
continue;
}
Creature* bunny = caster->FindNearestCreature(NPC_TORCH_TARGET, 100.0f);
if (!rand)
{
pos.Relocate(*itr);
break;
}
}
if (!bunny)
return;
// we have any pos
if (pos.GetPositionX())
{
caster->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_FLING_TORCH, true);
caster->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_TORCH_SHADOW, true);
}
// targets are located on a circle with fixed radius around the target bunny
// first target is chosen randomly anywhere on the circle
// next target is chosen on the opposite half of the circle
// so a minimum flight duration of the torch is guaranteed
float angle = 0.0f;
if (GetSpellInfo()->Id == SPELL_FLING_TORCH_DUMMY)
angle = frand(-1.0f * M_PI, 1.0f * M_PI); // full circle
else
angle = frand(-0.5f * M_PI, 0.5f * M_PI); // half circle
Position pos = bunny->GetPosition();
pos.SetOrientation(caster->GetPosition().GetAbsoluteAngle(pos));
pos.RelocatePolarOffset(angle, 8.0f); // radius is sniffed value
caster->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_FLING_TORCH, true);
caster->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_TORCH_SHADOW, true);
}
void HandleFinish()
@@ -1108,15 +1093,11 @@ class spell_midsummer_fling_torch : public SpellScript
void Register() override
{
AfterCast += SpellCastFn(spell_midsummer_fling_torch::HandleFinish);
OnCheckCast += SpellCheckCastFn(spell_midsummer_fling_torch::CheckCast);
if (m_scriptSpellId == SPELL_JUGGLE_TORCH)
{
OnEffectHitTarget += SpellEffectFn(spell_midsummer_fling_torch::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
}
private:
std::list<Creature*> _crList;
};
enum eJuggle

View File

@@ -59,19 +59,12 @@ enum Misc
struct boss_high_astromancer_solarian : public BossAI
{
boss_high_astromancer_solarian(Creature* creature) : BossAI(creature, DATA_ASTROMANCER)
{
scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
});
}
boss_high_astromancer_solarian(Creature* creature) : BossAI(creature, DATA_ASTROMANCER) { }
void Reset() override
{
BossAI::Reset();
me->SetModelVisible(true);
_visible = true;
ScheduleHealthCheckEvent(20, [&]{
scheduler.CancelAll();
@@ -131,7 +124,6 @@ struct boss_high_astromancer_solarian : public BossAI
context.Repeat(33900ms, 48100ms);
}).Schedule(52100ms, [this](TaskContext context)
{
_visible = false;
me->SetReactState(REACT_PASSIVE);
me->SetModelVisible(false);
scheduler.DelayAll(21s);
@@ -158,7 +150,6 @@ struct boss_high_astromancer_solarian : public BossAI
});
}).Schedule(20s, [this](TaskContext)
{
_visible = true;
me->SetReactState(REACT_AGGRESSIVE);
Talk(SAY_SUMMON2);
summons.DoForAllSummons([&](WorldObject* summon)
@@ -204,7 +195,7 @@ struct boss_high_astromancer_solarian : public BossAI
scheduler.Update(diff);
if (_visible)
if (me->GetReactState() == REACT_AGGRESSIVE)
{
DoMeleeAttackIfReady();
}
@@ -223,76 +214,52 @@ struct boss_high_astromancer_solarian : public BossAI
{
return me->GetDistance2d(432.59f, -371.93f) > 105.0f;
}
private:
bool _visible;
};
class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader
class spell_astromancer_wrath_of_the_astromancer : public AuraScript
{
public:
spell_astromancer_wrath_of_the_astromancer() : SpellScriptLoader("spell_astromancer_wrath_of_the_astromancer") { }
PrepareAuraScript(spell_astromancer_wrath_of_the_astromancer);
class spell_astromancer_wrath_of_the_astromancer_AuraScript : public AuraScript
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PrepareAuraScript(spell_astromancer_wrath_of_the_astromancer_AuraScript);
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
Unit* target = GetUnitOwner();
target->CastSpell(target, GetSpellInfo()->Effects[EFFECT_1].CalcValue(), false);
}
Unit* target = GetUnitOwner();
target->CastSpell(target, GetSpellInfo()->Effects[EFFECT_1].CalcValue(), false);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_astromancer_wrath_of_the_astromancer_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_astromancer_wrath_of_the_astromancer_AuraScript();
AfterEffectRemove += AuraEffectRemoveFn(spell_astromancer_wrath_of_the_astromancer::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_astromancer_solarian_transform : public SpellScriptLoader
class spell_astromancer_solarian_transform : public AuraScript
{
public:
spell_astromancer_solarian_transform() : SpellScriptLoader("spell_astromancer_solarian_transform") { }
PrepareAuraScript(spell_astromancer_solarian_transform);
class spell_astromancer_solarian_transform_AuraScript : public AuraScript
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PrepareAuraScript(spell_astromancer_solarian_transform_AuraScript);
GetUnitOwner()->HandleStatModifier(UnitMods(UNIT_MOD_ARMOR), TOTAL_PCT, 400.0f, true);
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->HandleStatModifier(UnitMods(UNIT_MOD_ARMOR), TOTAL_PCT, 400.0f, true);
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->HandleStatModifier(UnitMods(UNIT_MOD_ARMOR), TOTAL_PCT, 400.0f, false);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_astromancer_solarian_transform_AuraScript::OnApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_astromancer_solarian_transform_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_astromancer_solarian_transform_AuraScript();
GetUnitOwner()->HandleStatModifier(UnitMods(UNIT_MOD_ARMOR), TOTAL_PCT, 400.0f, false);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_astromancer_solarian_transform::OnApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_astromancer_solarian_transform::OnRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
}
};
void AddSC_boss_high_astromancer_solarian()
{
RegisterTheEyeAI(boss_high_astromancer_solarian);
new spell_astromancer_wrath_of_the_astromancer();
new spell_astromancer_solarian_transform();
RegisterSpellScript(spell_astromancer_wrath_of_the_astromancer);
RegisterSpellScript(spell_astromancer_solarian_transform);
}

View File

@@ -245,49 +245,6 @@ public:
}
};
/*######
## at_sholazar_waygate
######*/
enum Waygate
{
SPELL_SHOLAZAR_TO_UNGORO_TELEPORT = 52056,
SPELL_UNGORO_TO_SHOLAZAR_TELEPORT = 52057,
AT_SHOLAZAR = 5046,
AT_UNGORO = 5047,
QUEST_THE_MAKERS_OVERLOOK = 12613,
QUEST_THE_MAKERS_PERCH = 12559,
QUEST_MEETING_A_GREAT_ONE = 13956,
};
class AreaTrigger_at_sholazar_waygate : public AreaTriggerScript
{
public:
AreaTrigger_at_sholazar_waygate() : AreaTriggerScript("at_sholazar_waygate") { }
bool OnTrigger(Player* player, AreaTrigger const* trigger) override
{
if (!player->isDead() && (player->GetQuestStatus(QUEST_MEETING_A_GREAT_ONE) != QUEST_STATUS_NONE ||
(player->GetQuestStatus(QUEST_THE_MAKERS_OVERLOOK) == QUEST_STATUS_REWARDED && player->GetQuestStatus(QUEST_THE_MAKERS_PERCH) == QUEST_STATUS_REWARDED)))
{
switch (trigger->entry)
{
case AT_SHOLAZAR:
player->CastSpell(player, SPELL_SHOLAZAR_TO_UNGORO_TELEPORT, true);
break;
case AT_UNGORO:
player->CastSpell(player, SPELL_UNGORO_TO_SHOLAZAR_TELEPORT, true);
break;
}
}
return false;
}
};
/*######
## at_nats_landing
######*/
@@ -490,7 +447,6 @@ void AddSC_areatrigger_scripts()
new AreaTrigger_at_stormwright_shelf();
new AreaTrigger_at_scent_larkorwi();
new AreaTrigger_at_last_rites();
new AreaTrigger_at_sholazar_waygate();
new AreaTrigger_at_nats_landing();
new AreaTrigger_at_sentry_point();
new AreaTrigger_at_brewfest();