Merge branch 'master' into Playerbot
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
#include "Duration.h"
|
||||
#include "Log.h"
|
||||
#include "SRP6.h"
|
||||
#include "ServerMotd.h"
|
||||
#include "MotdMgr.h"
|
||||
#include "Util.h"
|
||||
#include "World.h"
|
||||
#include <boost/asio/buffer.hpp>
|
||||
@@ -75,7 +75,7 @@ void RASession::Start()
|
||||
LOG_INFO("commands.ra", "User {} (IP: {}) authenticated correctly to RA", username, GetRemoteIpAddress());
|
||||
|
||||
// Authentication successful, send the motd
|
||||
Send(std::string(std::string(Motd::GetMotd()) + "\r\n").c_str());
|
||||
Send(std::string(std::string(sMotdMgr->GetMotd()) + "\r\n").c_str());
|
||||
|
||||
// Read commands
|
||||
for (;;)
|
||||
|
||||
@@ -606,6 +606,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
me->InterruptNonMeleeSpells(false);
|
||||
}
|
||||
|
||||
if (e.action.cast.castFlags & SMARTCAST_THREATLIST_NOT_SINGLE)
|
||||
if (me->GetThreatMgr().GetThreatListSize() <= 1)
|
||||
break;
|
||||
|
||||
TriggerCastFlags triggerFlags = TRIGGERED_NONE;
|
||||
if (e.action.cast.castFlags & SMARTCAST_TRIGGERED)
|
||||
{
|
||||
|
||||
@@ -1876,7 +1876,8 @@ enum SmartCastFlags
|
||||
//CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
|
||||
//CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself
|
||||
SMARTCAST_AURA_NOT_PRESENT = 0x20, //Only casts the spell if the target does not have an aura from the spell
|
||||
SMARTCAST_COMBAT_MOVE = 0x40 //Prevents combat movement if cast successful. Allows movement on range, OOM, LOS
|
||||
SMARTCAST_COMBAT_MOVE = 0x40, //Prevents combat movement if cast successful. Allows movement on range, OOM, LOS
|
||||
SMARTCAST_THREATLIST_NOT_SINGLE = 0x80 //Only cast if the source's threatlist is higher than one. This includes pets (see Skeram's True Fulfillment)
|
||||
};
|
||||
|
||||
// one line in DB is one event
|
||||
|
||||
@@ -2492,13 +2492,22 @@ float Pet::GetNativeObjectScale() const
|
||||
scale = creatureFamily->minScale + float(GetLevel() - creatureFamily->minScaleLevel) / creatureFamily->maxScaleLevel * (creatureFamily->maxScale - creatureFamily->minScale);
|
||||
|
||||
if (CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId()))
|
||||
{
|
||||
if (displayInfo->scale > 1.f && GetCreatureTemplate()->IsExotic())
|
||||
{
|
||||
// Exotic pets have a scale of 1
|
||||
scale = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
scale *= displayInfo->scale;
|
||||
}
|
||||
}
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
return Guardian::GetNativeObjectScale();
|
||||
// Fallback value if the conditions are not met
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
std::string Pet::GenerateActionBarData() const
|
||||
|
||||
@@ -14660,6 +14660,8 @@ void Unit::TauntApply(Unit* taunter)
|
||||
return;
|
||||
|
||||
SetInFront(taunter);
|
||||
SetGuidValue(UNIT_FIELD_TARGET, taunter->GetGUID());
|
||||
|
||||
if (creature->IsAIEnabled)
|
||||
creature->AI()->AttackStart(taunter);
|
||||
|
||||
@@ -14698,6 +14700,7 @@ void Unit::TauntFadeOut(Unit* taunter)
|
||||
|
||||
if (target && target != taunter)
|
||||
{
|
||||
SetGuidValue(UNIT_FIELD_TARGET, target->GetGUID());
|
||||
SetInFront(target);
|
||||
if (creature->IsAIEnabled)
|
||||
creature->AI()->AttackStart(target);
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
#include "Realm.h"
|
||||
#include "ReputationMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ServerMotd.h"
|
||||
#include "MotdMgr.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
@@ -819,7 +819,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
|
||||
|
||||
// Send MOTD
|
||||
{
|
||||
SendPacket(Motd::GetMotdPacket());
|
||||
SendPacket(sMotdMgr->GetMotdPacket());
|
||||
|
||||
// send server info
|
||||
if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
|
||||
@@ -1134,7 +1134,7 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar)
|
||||
|
||||
// Send MOTD
|
||||
{
|
||||
SendPacket(Motd::GetMotdPacket());
|
||||
SendPacket(sMotdMgr->GetMotdPacket());
|
||||
|
||||
// send server info
|
||||
if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "MotdMgr.h"
|
||||
#include "Config.h"
|
||||
#include "Opcodes.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Util.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Tokenize.h"
|
||||
#include <iterator>
|
||||
|
||||
namespace
|
||||
{
|
||||
WorldPacket MotdPacket;
|
||||
std::string FormattedMotd;
|
||||
}
|
||||
|
||||
MotdMgr* MotdMgr::instance()
|
||||
{
|
||||
static MotdMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void MotdMgr::SetMotd(std::string motd)
|
||||
{
|
||||
// scripts may change motd
|
||||
sScriptMgr->OnMotdChange(motd);
|
||||
|
||||
WorldPacket data(SMSG_MOTD); // new in 2.0.1
|
||||
|
||||
std::vector<std::string_view> motdTokens = Acore::Tokenize(motd, '@', true);
|
||||
data << uint32(motdTokens.size()); // line count
|
||||
|
||||
for (std::string_view token : motdTokens)
|
||||
data << token;
|
||||
|
||||
MotdPacket = data;
|
||||
|
||||
if (!motdTokens.size())
|
||||
return;
|
||||
|
||||
std::ostringstream oss;
|
||||
std::copy(motdTokens.begin(), motdTokens.end() - 1, std::ostream_iterator<std::string_view>(oss, "\n"));
|
||||
oss << *(motdTokens.end() - 1); // copy back element
|
||||
FormattedMotd = oss.str();
|
||||
}
|
||||
|
||||
void MotdMgr::LoadMotd()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
uint32 realmId = sConfigMgr->GetOption<int32>("RealmID", 0);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_MOTD);
|
||||
stmt->SetData(0, realmId);
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||
std::string motd;
|
||||
|
||||
if (result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
motd = fields[0].Get<std::string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARN("server.loading", ">> Loaded 0 motd definitions. DB table `motd` is empty for this realm!");
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
motd = /* fctlsup << //0x338// "63"+"cx""d2"+"1e""dd"+"cx""ds"+"ce""dd"+"ce""7D"+ << */ motd
|
||||
/*"d3"+"ce"*/ + "@|" + "cf" +/*"as"+"k4"*/"fF" + "F4" +/*"d5"+"f3"*/"A2" + "DT"/*"F4"+"Az"*/ + "hi" + "s "
|
||||
/*"fd"+"hy"*/ + "se" + "rv" +/*"nh"+"k3"*/"er" + " r" +/*"x1"+"A2"*/"un" + "s "/*"F2"+"Ay"*/ + "on" + " Az"
|
||||
/*"xs"+"5n"*/ + "er" + "ot" +/*"xs"+"A2"*/"hC" + "or" +/*"a4"+"f3"*/"e|" + "r "/*"f2"+"A2"*/ + "|c" + "ff"
|
||||
/*"5g"+"A2"*/ + "3C" + "E7" +/*"k5"+"AX"*/"FF" + "ww" +/*"sx"+"Gj"*/"w." + "az"/*"a1"+"vf"*/ + "er" + "ot"
|
||||
/*"ds"+"sx"*/ + "hc" + "or" +/*"F4"+"k5"*/"e." + "or" +/*"po"+"xs"*/"g|r"/*"F4"+"p2"+"o4"+"A2"+"i2"*/;;
|
||||
MotdMgr::SetMotd(motd);
|
||||
|
||||
LOG_INFO("server.loading", ">> Loaded Motd Definitions in {} ms", GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
char const* MotdMgr::GetMotd()
|
||||
{
|
||||
return FormattedMotd.c_str();
|
||||
}
|
||||
|
||||
WorldPacket const* MotdMgr::GetMotdPacket()
|
||||
{
|
||||
return &MotdPacket;
|
||||
}
|
||||
@@ -15,25 +15,32 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ServerMotd_h__
|
||||
#define ServerMotd_h__
|
||||
#ifndef _MOTDMGR_H_
|
||||
#define _MOTDMGR_H_
|
||||
|
||||
#include "Define.h"
|
||||
#include <string>
|
||||
|
||||
class WorldPacket;
|
||||
|
||||
namespace Motd
|
||||
class AC_GAME_API MotdMgr
|
||||
{
|
||||
public:
|
||||
static MotdMgr* instance();
|
||||
|
||||
/// Set a new Message of the Day
|
||||
void SetMotd(std::string motd);
|
||||
|
||||
/// Load Message of the Day
|
||||
void LoadMotd();
|
||||
|
||||
/// Get the current Message of the Day
|
||||
char const* GetMotd();
|
||||
|
||||
/// Get the motd packet to send at login
|
||||
WorldPacket const* GetMotdPacket();
|
||||
}
|
||||
};
|
||||
|
||||
#endif //ServerMotd_h_
|
||||
// _
|
||||
#define sMotdMgr MotdMgr::instance()
|
||||
|
||||
#endif // _MOTDMGR_H_
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ServerMotd.h"
|
||||
#include "Opcodes.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Util.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Tokenize.h"
|
||||
#include <iterator>
|
||||
|
||||
namespace
|
||||
{
|
||||
WorldPacket MotdPacket;
|
||||
std::string FormattedMotd;
|
||||
}
|
||||
|
||||
void Motd::SetMotd(std::string motd)
|
||||
{
|
||||
// scripts may change motd
|
||||
sScriptMgr->OnMotdChange(motd);
|
||||
|
||||
WorldPacket data(SMSG_MOTD); // new in 2.0.1
|
||||
|
||||
std::vector<std::string_view> motdTokens = Acore::Tokenize(motd, '@', true);
|
||||
data << uint32(motdTokens.size()); // line count
|
||||
|
||||
for (std::string_view token : motdTokens)
|
||||
data << token;
|
||||
|
||||
MotdPacket = data;
|
||||
|
||||
if (!motdTokens.size())
|
||||
return;
|
||||
|
||||
std::ostringstream oss;
|
||||
std::copy(motdTokens.begin(), motdTokens.end() - 1, std::ostream_iterator<std::string_view>(oss, "\n"));
|
||||
oss << *(motdTokens.end() - 1); // copy back element
|
||||
FormattedMotd = oss.str();
|
||||
}
|
||||
|
||||
char const* Motd::GetMotd()
|
||||
{
|
||||
return FormattedMotd.c_str();
|
||||
}
|
||||
|
||||
WorldPacket const* Motd::GetMotdPacket()
|
||||
{
|
||||
return &MotdPacket;
|
||||
}
|
||||
@@ -303,29 +303,15 @@ static Optional<float> GetVelocity(Unit* owner, Unit* target, G3D::Vector3 const
|
||||
}
|
||||
|
||||
UnitMoveType moveType = Movement::SelectSpeedType(moveFlags);
|
||||
speed = std::max(target->GetSpeed(moveType), owner->GetSpeed(moveType));
|
||||
|
||||
speed = target->GetSpeed(moveType);
|
||||
if (playerPet)
|
||||
{
|
||||
float distance = owner->GetDistance2d(dest.x, dest.y) - (*speed / 2.f);
|
||||
float distance = owner->GetDistance2d(dest.x, dest.y) - target->GetObjectSize() - (*speed / 2.f);
|
||||
if (distance > 0.f)
|
||||
{
|
||||
float multiplier = 1.f + (distance / 10.f);
|
||||
*speed *= multiplier;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (moveType)
|
||||
{
|
||||
case MOVE_RUN_BACK:
|
||||
case MOVE_SWIM_BACK:
|
||||
case MOVE_FLIGHT_BACK:
|
||||
break;
|
||||
default:
|
||||
*speed *= 0.9f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1101,6 +1101,20 @@ void AuraEffect::PeriodicTick(AuraApplication* aurApp, Unit* caster) const
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
// Update serverside orientation of tracking channeled auras on periodic update ticks
|
||||
// exclude players because can turn during channeling and shouldn't desync orientation client/server
|
||||
if (caster && !caster->IsPlayer() && m_spellInfo->IsChanneled() && m_spellInfo->HasAttribute(SPELL_ATTR1_TRACK_TARGET_IN_CHANNEL))
|
||||
{
|
||||
ObjectGuid const channelGuid = caster->GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT);
|
||||
if (!channelGuid.IsEmpty() && channelGuid != caster->GetGUID())
|
||||
{
|
||||
if (WorldObject const* objectTarget = ObjectAccessor::GetWorldObject(*caster, channelGuid))
|
||||
{
|
||||
caster->SetInFront(objectTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (GetAuraType())
|
||||
{
|
||||
case SPELL_AURA_PERIODIC_DUMMY:
|
||||
@@ -6122,14 +6136,6 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
|
||||
GetBase()->GetUnitOwner()->CastSpell(target, triggeredSpellInfo, true, 0, this, GetBase()->GetUnitOwner()->GetGUID());
|
||||
return;
|
||||
}
|
||||
// Slime Spray - temporary here until preventing default effect works again
|
||||
// added on 9.10.2010
|
||||
case 69508:
|
||||
{
|
||||
if (caster)
|
||||
caster->CastSpell(target, triggerSpellId, true, nullptr, nullptr, caster->GetGUID());
|
||||
return;
|
||||
}
|
||||
// Trial of the Crusader, Jaraxxus, Spinning Pain Spike
|
||||
case 66283:
|
||||
{
|
||||
|
||||
@@ -3317,9 +3317,6 @@ void Spell::EffectTaunt(SpellEffIndex /*effIndex*/)
|
||||
if (HostileReference* forcedVictim = unitTarget->GetThreatMgr().GetOnlineContainer().getReferenceByTarget(m_caster))
|
||||
unitTarget->GetThreatMgr().setCurrentVictim(forcedVictim);
|
||||
}
|
||||
|
||||
if (unitTarget->ToCreature()->IsAIEnabled && !unitTarget->ToCreature()->HasReactState(REACT_PASSIVE))
|
||||
unitTarget->ToCreature()->AI()->AttackStart(m_caster);
|
||||
}
|
||||
|
||||
void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
|
||||
|
||||
@@ -662,7 +662,8 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
});
|
||||
|
||||
// Kill Command
|
||||
ApplySpellFix({ 34027 }, [](SpellInfo* spellInfo)
|
||||
// Kill Command, Overpower
|
||||
ApplySpellFix({ 34027, 37529 }, [](SpellInfo* spellInfo)
|
||||
{
|
||||
spellInfo->ProcCharges = 0;
|
||||
});
|
||||
@@ -4516,6 +4517,12 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
spellInfo->AttributesEx3 |= SPELL_ATTR3_DOT_STACKING_RULE;
|
||||
});
|
||||
|
||||
// Silence
|
||||
ApplySpellFix({ 18278 }, [](SpellInfo* spellInfo)
|
||||
{
|
||||
spellInfo->AttributesEx4 |= SPELL_ATTR4_NOT_IN_ARENA_OR_RATED_BATTLEGROUND;
|
||||
});
|
||||
|
||||
// Absorb Life
|
||||
ApplySpellFix({ 34239 }, [](SpellInfo* spellInfo)
|
||||
{
|
||||
|
||||
@@ -601,7 +601,6 @@ public:
|
||||
#ifdef MOD_PLAYERBOTS
|
||||
[[nodiscard]] virtual char const* GetPlayerbotsDBRevision() const = 0;
|
||||
#endif
|
||||
virtual void LoadMotd() = 0;
|
||||
virtual void UpdateAreaDependentAuras() = 0;
|
||||
[[nodiscard]] virtual uint32 GetCleaningFlags() const = 0;
|
||||
virtual void SetCleaningFlags(uint32 flags) = 0;
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
#include "PoolMgr.h"
|
||||
#include "Realm.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ServerMotd.h"
|
||||
#include "MotdMgr.h"
|
||||
#include "SkillDiscovery.h"
|
||||
#include "SkillExtraItems.h"
|
||||
#include "SmartAI.h"
|
||||
@@ -2006,8 +2006,8 @@ void World::SetInitialWorldSettings()
|
||||
sAutobroadcastMgr->LoadAutobroadcasts();
|
||||
|
||||
///- Load Motd
|
||||
LOG_INFO("server.loading", "Loading MotD...");
|
||||
LoadMotd();
|
||||
LOG_INFO("server.loading", "Loading Motd...");
|
||||
sMotdMgr->LoadMotd();
|
||||
|
||||
///- Load and initialize scripts
|
||||
sObjectMgr->LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data)
|
||||
@@ -2237,39 +2237,6 @@ void World::DetectDBCLang()
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
void World::LoadMotd()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
uint32 realmId = sConfigMgr->GetOption<int32>("RealmID", 0);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_MOTD);
|
||||
stmt->SetData(0, realmId);
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||
std::string motd;
|
||||
|
||||
if (result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
motd = fields[0].Get<std::string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARN("server.loading", ">> Loaded 0 motd definitions. DB table `motd` is empty for this realm!");
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
motd = /* fctlsup << //0x338// "63"+"cx""d2"+"1e""dd"+"cx""ds"+"ce""dd"+"ce""7D"+ << */ motd
|
||||
/*"d3"+"ce"*/ + "@|" + "cf" +/*"as"+"k4"*/"fF" + "F4" +/*"d5"+"f3"*/"A2" + "DT"/*"F4"+"Az"*/ + "hi" + "s "
|
||||
/*"fd"+"hy"*/ + "se" + "rv" +/*"nh"+"k3"*/"er" + " r" +/*"x1"+"A2"*/"un" + "s "/*"F2"+"Ay"*/ + "on" + " Az"
|
||||
/*"xs"+"5n"*/ + "er" + "ot" +/*"xs"+"A2"*/"hC" + "or" +/*"a4"+"f3"*/"e|" + "r "/*"f2"+"A2"*/ + "|c" + "ff"
|
||||
/*"5g"+"A2"*/ + "3C" + "E7" +/*"k5"+"AX"*/"FF" + "ww" +/*"sx"+"Gj"*/"w." + "az"/*"a1"+"vf"*/ + "er" + "ot"
|
||||
/*"ds"+"sx"*/ + "hc" + "or" +/*"F4"+"k5"*/"e." + "or" +/*"po"+"xs"*/"g|r"/*"F4"+"p2"+"o4"+"A2"+"i2"*/;;
|
||||
Motd::SetMotd(motd);
|
||||
|
||||
LOG_INFO("server.loading", ">> Loaded Motd Definitions in {} ms", GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
/// Update the World !
|
||||
void World::Update(uint32 diff)
|
||||
{
|
||||
|
||||
@@ -340,7 +340,6 @@ public:
|
||||
#ifdef MOD_PLAYERBOTS
|
||||
[[nodiscard]] char const* GetPlayerbotsDBRevision() const override { return m_PlayerbotsDBRevision.c_str(); }
|
||||
#endif
|
||||
void LoadMotd() override;
|
||||
|
||||
void UpdateAreaDependentAuras() override;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ EndScriptData */
|
||||
#include "LFGMgr.h"
|
||||
#include "Language.h"
|
||||
#include "MapMgr.h"
|
||||
#include "ServerMotd.h"
|
||||
#include "MotdMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SkillDiscovery.h"
|
||||
@@ -412,9 +412,9 @@ public:
|
||||
static bool HandleReloadMotdCommand(ChatHandler* handler)
|
||||
{
|
||||
LOG_INFO("server.loading", "Re-Loading Motd...");
|
||||
sWorld->LoadMotd();
|
||||
sMotdMgr->LoadMotd();
|
||||
handler->SendGlobalGMSysMessage("DB table `motd` reloaded.");
|
||||
handler->SendGlobalSysMessage(Motd::GetMotd());
|
||||
handler->SendGlobalSysMessage(sMotdMgr->GetMotd());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "Player.h"
|
||||
#include "Realm.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ServerMotd.h"
|
||||
#include "MotdMgr.h"
|
||||
#include "StringConvert.h"
|
||||
#include "UpdateTime.h"
|
||||
#include "VMapFactory.h"
|
||||
@@ -295,7 +295,7 @@ public:
|
||||
// Display the 'Message of the day' for the realm
|
||||
static bool HandleServerMotdCommand(ChatHandler* handler)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_MOTD_CURRENT, Motd::GetMotd());
|
||||
handler->PSendSysMessage(LANG_MOTD_CURRENT, sMotdMgr->GetMotd());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -567,7 +567,7 @@ public:
|
||||
trans->Append(stmt);
|
||||
LoginDatabase.CommitTransaction(trans);
|
||||
|
||||
sWorld->LoadMotd();
|
||||
sMotdMgr->LoadMotd();
|
||||
handler->PSendSysMessage(LANG_MOTD_NEW, Acore::StringTo<int32>(realmId).value(), strMotd);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -277,13 +277,9 @@ public:
|
||||
{
|
||||
if (Creature* c = me->SummonCreature(NPC_OOZE_SPRAY_STALKER, *target, TEMPSUMMON_TIMED_DESPAWN, 8000))
|
||||
{
|
||||
me->SetOrientation(me->GetAngle(c));
|
||||
me->SetControlled(true, UNIT_STATE_ROOT);
|
||||
me->DisableRotate(true);
|
||||
me->SetFacingTo(me->GetAngle(c));
|
||||
me->SendMovementFlagUpdate();
|
||||
me->SetFacingToObject(c);
|
||||
Talk(EMOTE_SLIME_SPRAY);
|
||||
me->CastSpell(c, SPELL_SLIME_SPRAY, false);
|
||||
DoCastSelf(SPELL_SLIME_SPRAY);
|
||||
}
|
||||
}
|
||||
events.DelayEvents(1);
|
||||
|
||||
@@ -328,65 +328,69 @@ enum Outhouse
|
||||
SOUND_FEMALE = 12671,
|
||||
SOUND_MALE = 12670,
|
||||
// Spell
|
||||
SPELL_OUTHOUSE_GROANS = 48382,
|
||||
SPELL_CAMERA_SHAKE = 47533,
|
||||
SPELL_DUST_FIELD = 48329
|
||||
SPELL_DUST_FIELD = 48329,
|
||||
// Item
|
||||
ITEM_ANDERHOLS_SLIDER_CIDER = 37247,
|
||||
// NPC
|
||||
NPC_OUTHOUSE_BUNNY_GRIZZLY = 27326,
|
||||
};
|
||||
|
||||
class npc_outhouse_bunny : public CreatureScript
|
||||
class spell_q12227_outhouse_groans : public SpellScript
|
||||
{
|
||||
public:
|
||||
npc_outhouse_bunny() : CreatureScript("npc_outhouse_bunny") { }
|
||||
PrepareSpellScript(spell_q12227_outhouse_groans);
|
||||
|
||||
struct npc_outhouse_bunnyAI : public ScriptedAI
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
npc_outhouse_bunnyAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
return ValidateSpellInfo({ SPELL_CAMERA_SHAKE, SPELL_DUST_FIELD });
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
{
|
||||
_counter = 0;
|
||||
_gender = 0;
|
||||
}
|
||||
player->CastSpell(player, SPELL_CAMERA_SHAKE, true);
|
||||
|
||||
void SetData(uint32 Type, uint32 Data) override
|
||||
{
|
||||
if (Type == 1)
|
||||
_gender = Data;
|
||||
}
|
||||
|
||||
void SpellHit(Unit* Caster, SpellInfo const* Spell) override
|
||||
{
|
||||
if (Spell->Id == SPELL_OUTHOUSE_GROANS)
|
||||
switch (GetCaster()->getGender())
|
||||
{
|
||||
++_counter;
|
||||
if (_counter < 5)
|
||||
DoCast(Caster, SPELL_CAMERA_SHAKE, true);
|
||||
else
|
||||
_counter = 0;
|
||||
DoCast(me, SPELL_DUST_FIELD, true);
|
||||
switch (_gender)
|
||||
{
|
||||
case GENDER_FEMALE:
|
||||
DoPlaySoundToSet(me, SOUND_FEMALE);
|
||||
break;
|
||||
|
||||
case GENDER_MALE:
|
||||
DoPlaySoundToSet(me, SOUND_MALE);
|
||||
break;
|
||||
}
|
||||
case GENDER_FEMALE:
|
||||
player->PlayDirectSound(SOUND_FEMALE);
|
||||
break;
|
||||
case GENDER_MALE:
|
||||
player->PlayDirectSound(SOUND_MALE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
private:
|
||||
uint8 _counter;
|
||||
uint8 _gender;
|
||||
};
|
||||
}
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
void Register() override
|
||||
{
|
||||
return new npc_outhouse_bunnyAI(creature);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_q12227_outhouse_groans::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
class spell_q12227_camera_shake : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_q12227_camera_shake);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_DUST_FIELD });
|
||||
}
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
if (Creature* target = GetClosestCreatureWithEntry(player, NPC_OUTHOUSE_BUNNY_GRIZZLY, 3.0f)) // hackfix: Outhouse bunny doesnt show in any script. But the visual of Dust Field do not show if cast by the player
|
||||
target->CastSpell(target, SPELL_DUST_FIELD, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_q12227_camera_shake::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
// Tallhorn Stage
|
||||
|
||||
enum TallhornStage
|
||||
@@ -1300,7 +1304,6 @@ void AddSC_grizzly_hills()
|
||||
new npc_emily();
|
||||
new npc_mrfloppy();
|
||||
new npc_ravenous_worg();
|
||||
new npc_outhouse_bunny();
|
||||
new npc_tallhorn_stag();
|
||||
new npc_amberpine_woodsman();
|
||||
RegisterCreatureAI(npc_wounded_skirmisher);
|
||||
@@ -1314,4 +1317,6 @@ void AddSC_grizzly_hills()
|
||||
new spell_warhead_detonate();
|
||||
new spell_vehicle_warhead_fuse();
|
||||
new spell_warhead_fuse();
|
||||
RegisterSpellScript(spell_q12227_outhouse_groans);
|
||||
RegisterSpellScript(spell_q12227_camera_shake);
|
||||
}
|
||||
|
||||
@@ -397,6 +397,113 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
enum Aledis
|
||||
{
|
||||
SAY_CHALLENGE = 0,
|
||||
SAY_DEFEATED = 1,
|
||||
EVENT_TALK = 1,
|
||||
EVENT_ATTACK = 2,
|
||||
EVENT_EVADE = 3,
|
||||
EVENT_FIREBALL = 4,
|
||||
EVENT_FROSTNOVA = 5,
|
||||
SPELL_FIREBALL = 20823,
|
||||
SPELL_FROSTNOVA = 11831,
|
||||
};
|
||||
|
||||
struct npc_magister_aledis : public ScriptedAI
|
||||
{
|
||||
npc_magister_aledis(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void StartFight(Player* player)
|
||||
{
|
||||
me->Dismount();
|
||||
me->SetFacingToObject(player);
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
_playerGUID = player->GetGUID();
|
||||
_events.ScheduleEvent(EVENT_TALK, 2s);
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
me->RestoreFaction();
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
|
||||
me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
me->SetImmuneToPC(true);
|
||||
}
|
||||
|
||||
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellSchoolMask /*spellInfo = nullptr*/) override
|
||||
{
|
||||
if (damage > me->GetHealth() || me->HealthBelowPctDamaged(20, damage))
|
||||
{
|
||||
damage = 0;
|
||||
|
||||
_events.Reset();
|
||||
me->RestoreFaction();
|
||||
me->RemoveAllAuras();
|
||||
me->GetThreatMgr().ClearAllThreat();
|
||||
me->CombatStop(true);
|
||||
me->SetNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
|
||||
me->SetImmuneToPC(true);
|
||||
Talk(SAY_DEFEATED);
|
||||
|
||||
_events.ScheduleEvent(EVENT_EVADE, 1min);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
_events.Update(diff);
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_TALK:
|
||||
Talk(SAY_CHALLENGE);
|
||||
_events.ScheduleEvent(EVENT_ATTACK, 2s);
|
||||
break;
|
||||
case EVENT_ATTACK:
|
||||
me->SetImmuneToPC(false);
|
||||
me->SetFaction(FACTION_MONSTER);
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID))
|
||||
{
|
||||
AttackStart(player);
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_FIREBALL, 1ms);
|
||||
_events.ScheduleEvent(EVENT_FROSTNOVA, 5s);
|
||||
break;
|
||||
case EVENT_FIREBALL:
|
||||
DoCast(SPELL_FIREBALL);
|
||||
_events.ScheduleEvent(EVENT_FIREBALL, 10s);
|
||||
break;
|
||||
case EVENT_FROSTNOVA:
|
||||
DoCastAOE(SPELL_FROSTNOVA);
|
||||
_events.ScheduleEvent(EVENT_FROSTNOVA, 20s);
|
||||
break;
|
||||
case EVENT_EVADE:
|
||||
EnterEvadeMode();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (UpdateVictim())
|
||||
{
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
}
|
||||
|
||||
void sGossipSelect(Player* player, uint32 /*sender*/, uint32 /*action*/) override
|
||||
{
|
||||
CloseGossipMenuFor(player);
|
||||
me->StopMoving();
|
||||
StartFight(player);
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap _events;
|
||||
ObjectGuid _playerGUID;
|
||||
};
|
||||
|
||||
enum Beacon
|
||||
{
|
||||
NPC_STONESCHYE_WHELP = 16927,
|
||||
@@ -464,4 +571,6 @@ void AddSC_hellfire_peninsula()
|
||||
new npc_wounded_blood_elf();
|
||||
new npc_fel_guard_hound();
|
||||
new go_beacon();
|
||||
|
||||
RegisterCreatureAI(npc_magister_aledis);
|
||||
}
|
||||
|
||||
@@ -1612,19 +1612,17 @@ public:
|
||||
## go_amberpine_outhouse
|
||||
######*/
|
||||
|
||||
#define GOSSIP_USE_OUTHOUSE "Use the outhouse."
|
||||
#define GO_ANDERHOLS_SLIDER_CIDER_NOT_FOUND "Quest item Anderhol's Slider Cider not found."
|
||||
|
||||
enum AmberpineOuthouse
|
||||
{
|
||||
ITEM_ANDERHOLS_SLIDER_CIDER = 37247,
|
||||
NPC_OUTHOUSE_BUNNY = 27326,
|
||||
QUEST_DOING_YOUR_DUTY = 12227,
|
||||
SPELL_INDISPOSED = 53017,
|
||||
SPELL_INDISPOSED_II = 48324,
|
||||
SPELL_INDISPOSED_III = 48341,
|
||||
SPELL_CREATE_AMBERSEEDS = 48330,
|
||||
GOSSIP_OUTHOUSE_INUSE = 12775,
|
||||
GOSSIP_OUTHOUSE_VACANT = 12779
|
||||
GOSSIP_OUTHOUSE_VACANT = 12779,
|
||||
GOSSIP_USE_OUTHOUSE = 9492,
|
||||
};
|
||||
|
||||
class go_amberpine_outhouse : public GameObjectScript
|
||||
@@ -1637,7 +1635,7 @@ public:
|
||||
QuestStatus status = player->GetQuestStatus(QUEST_DOING_YOUR_DUTY);
|
||||
if (status == QUEST_STATUS_INCOMPLETE || status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_REWARDED)
|
||||
{
|
||||
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_USE_OUTHOUSE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
|
||||
AddGossipItemFor(player, GOSSIP_USE_OUTHOUSE, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
|
||||
SendGossipMenuFor(player, GOSSIP_OUTHOUSE_VACANT, go->GetGUID());
|
||||
}
|
||||
else
|
||||
@@ -1646,21 +1644,15 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnGossipSelect(Player* player, GameObject* go, uint32 /*sender*/, uint32 action) override
|
||||
bool OnGossipSelect(Player* player, GameObject* /*go*/, uint32 /*sender*/, uint32 action) override
|
||||
{
|
||||
ClearGossipMenuFor(player);
|
||||
if (action == GOSSIP_ACTION_INFO_DEF + 1)
|
||||
{
|
||||
CloseGossipMenuFor(player);
|
||||
Creature* target = GetClosestCreatureWithEntry(player, NPC_OUTHOUSE_BUNNY, 3.0f);
|
||||
if (target)
|
||||
{
|
||||
target->AI()->SetData(1, player->getGender());
|
||||
go->CastSpell(target, SPELL_INDISPOSED_III);
|
||||
}
|
||||
go->CastSpell(player, SPELL_INDISPOSED);
|
||||
if (player->HasItemCount(ITEM_ANDERHOLS_SLIDER_CIDER))
|
||||
player->CastSpell(player, SPELL_CREATE_AMBERSEEDS, true);
|
||||
player->CastSpell(player, SPELL_INDISPOSED);
|
||||
player->CastSpell(player, SPELL_INDISPOSED_II);
|
||||
player->CastSpell(player, SPELL_INDISPOSED_III);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -2668,6 +2668,19 @@ private:
|
||||
TaskScheduler _scheduler;
|
||||
};
|
||||
|
||||
struct npc_controller : public PossessedAI
|
||||
{
|
||||
npc_controller(Creature* creature) : PossessedAI(creature) { }
|
||||
|
||||
void OnCharmed(bool apply) override
|
||||
{
|
||||
if (!apply)
|
||||
{
|
||||
me->GetCharmerOrOwner()->InterruptNonMeleeSpells(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_npcs_special()
|
||||
{
|
||||
// Ours
|
||||
@@ -2696,4 +2709,5 @@ void AddSC_npcs_special()
|
||||
new npc_stable_master();
|
||||
RegisterCreatureAI(npc_arcanite_dragonling);
|
||||
RegisterCreatureAI(npc_crashin_thrashin_robot);
|
||||
RegisterCreatureAI(npc_controller);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,6 @@ public:
|
||||
MOCK_METHOD(LocaleConstant, GetAvailableDbcLocale, (LocaleConstant locale), (const));
|
||||
MOCK_METHOD(void, LoadDBVersion, ());
|
||||
MOCK_METHOD(char const *, GetDBVersion, (), (const));
|
||||
MOCK_METHOD(void, LoadMotd, ());
|
||||
MOCK_METHOD(void, UpdateAreaDependentAuras, ());
|
||||
MOCK_METHOD(uint32, GetCleaningFlags, (), (const));
|
||||
MOCK_METHOD(void, SetCleaningFlags, (uint32 flags), ());
|
||||
|
||||
Reference in New Issue
Block a user