Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-01-23 12:31:39 +08:00
4560 changed files with 301617 additions and 294556 deletions

View File

@@ -250,7 +250,7 @@ public:
creature->CleanupsBeforeDelete();
delete creature;
creature = new Creature();
if (!creature->LoadCreatureFromDB(spawnId, map, true, false, true))
if (!creature->LoadCreatureFromDB(spawnId, map, true, true))
{
delete creature;
return false;

View File

@@ -525,40 +525,32 @@ public:
}
// Define the 'Message of the day' for the realm
static bool HandleServerSetMotdCommand(ChatHandler* handler, std::string realmId, Tail motd)
static bool HandleServerSetMotdCommand(ChatHandler* handler, Optional<int32> realmId, Tail motd)
{
std::wstring wMotd = std::wstring();
std::string strMotd = std::string();
if (realmId.empty())
{
return false;
}
if (!realmId)
realmId = static_cast<int32>(realm.Id.Realm);
if (motd.empty())
{
return false;
}
if (!Utf8toWStr(motd, wMotd))
{
return false;
}
if (!WStrToUtf8(wMotd, strMotd))
{
return false;
}
LoginDatabaseTransaction trans = LoginDatabase.BeginTransaction();
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_REP_MOTD);
stmt->SetData(0, Acore::StringTo<int32>(realmId).value());
stmt->SetData(0, realmId.value());
stmt->SetData(1, strMotd);
trans->Append(stmt);
LoginDatabase.CommitTransaction(trans);
sMotdMgr->LoadMotd();
handler->PSendSysMessage(LANG_MOTD_NEW, Acore::StringTo<int32>(realmId).value(), strMotd);
handler->PSendSysMessage(LANG_MOTD_NEW, realmId.value(), strMotd);
return true;
}

View File

@@ -700,7 +700,7 @@ public:
wpCreature2->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
//TODO: Should we first use "Create" then use "LoadFromDB"?
if (!wpCreature2->LoadCreatureFromDB(wpCreature2->GetSpawnId(), map, true, false, true))
if (!wpCreature2->LoadCreatureFromDB(wpCreature2->GetSpawnId(), map, true, true))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
delete wpCreature2;
@@ -923,7 +923,7 @@ public:
wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
if (!wpCreature->LoadCreatureFromDB(wpCreature->GetSpawnId(), map, true, false, true))
if (!wpCreature->LoadCreatureFromDB(wpCreature->GetSpawnId(), map, true, true))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
delete wpCreature;
@@ -975,7 +975,7 @@ public:
}
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
if (!creature->LoadCreatureFromDB(creature->GetSpawnId(), map, true, false, true))
if (!creature->LoadCreatureFromDB(creature->GetSpawnId(), map, true, true))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
delete creature;
@@ -1024,7 +1024,7 @@ public:
}
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
if (!creature->LoadCreatureFromDB(creature->GetSpawnId(), map, true, false, true))
if (!creature->LoadCreatureFromDB(creature->GetSpawnId(), map, true, true))
{
handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id);
delete creature;

View File

@@ -1195,6 +1195,49 @@ class spell_midsummer_torch_catch : public SpellScript
}
};
// 46592 - Summon Ahune Lieutenant
class spell_midsummer_summon_ahune_lieutenant : public SpellScript
{
PrepareSpellScript(spell_midsummer_summon_ahune_lieutenant);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
uint32 zoneId = caster->GetZoneId();
uint32 npcEntry = 0;
switch (zoneId)
{
case 331: // Ashenvale
npcEntry = 26116; // Frostwave Lieutenant
break;
case 405: // Desolace
npcEntry = 26178; // Hailstone Lieutenant
break;
case 33: // Stranglethorn Vale
npcEntry = 26204; // Chillwind Lieutenant
break;
case 51: // Searing Gorge
npcEntry = 26214; // Frigid Lieutenant
break;
case 1377: // Silithus
npcEntry = 26215; // Glacial Lieutenant
break;
case 3483: // Hellfire Peninsula
npcEntry = 26216; // Glacial Templar
break;
}
if (npcEntry)
caster->SummonCreature(npcEntry, caster->GetPosition(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, MINUTE * IN_MILLISECONDS);
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_midsummer_summon_ahune_lieutenant::HandleDummy, EFFECT_1, SPELL_EFFECT_APPLY_AURA);
}
};
void AddSC_event_midsummer_scripts()
{
// Player
@@ -1215,5 +1258,6 @@ void AddSC_event_midsummer_scripts()
RegisterSpellScript(spell_midsummer_fling_torch);
RegisterSpellScript(spell_midsummer_juggling_torch);
RegisterSpellScript(spell_midsummer_torch_catch);
RegisterSpellScript(spell_midsummer_summon_ahune_lieutenant);
}

View File

@@ -1673,8 +1673,8 @@ public:
data >> LichKingHeroicAvailable;
data >> BloodPrinceTrashCount;
data >> IsBuffAvailable;
SetData(DATA_BUFF_AVAILABLE, IsBuffAvailable);
data >> IsSindragosaIntroDone;
SetData(DATA_BUFF_AVAILABLE, IsBuffAvailable);
}
void WriteSaveDataMore(std::ostringstream& data) override

View File

@@ -91,7 +91,7 @@ void UpdateCreatureHalaa(ObjectGuid::LowType spawnId, Map* map, float x, float y
if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
{
Creature* creature = new Creature();
if (!creature->LoadCreatureFromDB(spawnId, map, true, false, true))
if (!creature->LoadCreatureFromDB(spawnId, map, true, true))
{
LOG_ERROR("sql.sql", "AddCreature: Cannot add creature spawnId {} to map", spawnId);
delete creature;

View File

@@ -174,11 +174,10 @@ struct boss_lady_vashj : public BossAI
{
return;
}
me->AddUnitState(UNIT_STATE_ROOT);
me->SetFacingTo(me->GetHomePosition().GetOrientation());
instance->SetData(DATA_ACTIVATE_SHIELD, 0);
scheduler.CancelAll();
scheduler.Schedule(2400ms, [this](TaskContext context)
{
DoCastRandomTarget(SPELL_FORKED_LIGHTNING);
@@ -204,6 +203,7 @@ struct boss_lady_vashj : public BossAI
if (!me->HasAura(SPELL_MAGIC_BARRIER))
{
Talk(SAY_PHASE3);
me->ClearUnitState(UNIT_STATE_ROOT);
me->SetReactState(REACT_AGGRESSIVE);
me->GetMotionMaster()->MoveChase(me->GetVictim());
scheduler.CancelAll();