feat(Core/Modules): add separated lib for modules (#9281)

This commit is contained in:
Kargatum
2021-12-02 20:28:58 +07:00
committed by GitHub
parent 8668a03e14
commit 51adbffae4
56 changed files with 1904 additions and 1014 deletions

View File

@@ -92,10 +92,6 @@
#include "WorldPacket.h"
#include "WorldSession.h"
#ifdef ELUNA
#include "LuaEngine.h"
#endif
enum CharacterFlags
{
CHARACTER_FLAG_NONE = 0x00000000,
@@ -4356,12 +4352,12 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
// update visibility
UpdateObjectVisibility();
#ifdef ELUNA
sEluna->OnResurrect(this);
#endif
sScriptMgr->OnPlayerResurrect(this, restore_percent, applySickness);
if(!applySickness)
if (!applySickness)
{
return;
}
//Characters from level 1-10 are not affected by resurrection sickness.
//Characters from level 11-19 will suffer from one minute of sickness
@@ -8774,11 +8770,12 @@ void Player::StopCastingCharm()
void Player::Say(std::string_view text, Language language, WorldObject const* /*= nullptr*/)
{
std::string _text(text);
sScriptMgr->OnPlayerChat(this, CHAT_MSG_SAY, language, _text);
#ifdef ELUNA
if (!sEluna->OnChat(this, CHAT_MSG_SAY, language, _text))
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_SAY, language, _text))
{
return;
#endif
}
sScriptMgr->OnPlayerChat(this, CHAT_MSG_SAY, language, _text);
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_SAY, language, this, this, _text);
@@ -8793,11 +8790,13 @@ void Player::Say(uint32 textId, WorldObject const* target /*= nullptr*/)
void Player::Yell(std::string_view text, Language language, WorldObject const* /*= nullptr*/)
{
std::string _text(text);
sScriptMgr->OnPlayerChat(this, CHAT_MSG_YELL, language, _text);
#ifdef ELUNA
if (!sEluna->OnChat(this, CHAT_MSG_YELL, language, _text))
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_YELL, language, _text))
{
return;
#endif
}
sScriptMgr->OnPlayerChat(this, CHAT_MSG_YELL, language, _text);
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_YELL, language, this, this, _text);
@@ -8812,11 +8811,13 @@ void Player::Yell(uint32 textId, WorldObject const* target /*= nullptr*/)
void Player::TextEmote(std::string_view text, WorldObject const* /*= nullptr*/, bool /*= false*/)
{
std::string _text(text);
sScriptMgr->OnPlayerChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text);
#ifdef ELUNA
if (!sEluna->OnChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text))
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text))
{
return;
#endif
}
sScriptMgr->OnPlayerChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text);
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_EMOTE, LANG_UNIVERSAL, this, this, _text);
@@ -8838,13 +8839,13 @@ void Player::Whisper(std::string_view text, Language language, Player* target, b
language = LANG_UNIVERSAL; // whispers should always be readable
std::string _text(text);
sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, target);
#ifdef ELUNA
if (!sEluna->OnChat(this, CHAT_MSG_WHISPER, language, _text, target))
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text, target))
{
return;
}
#endif
sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, target);
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_WHISPER, language, this, this, _text);
@@ -12803,9 +12804,6 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot)
if (loot->containerGUID)
sLootItemStorage->RemoveStoredLootItem(loot->containerGUID, item->itemid, item->count, loot, item->itemIndex);
#ifdef ELUNA
sEluna->OnLootItem(this, newitem, item->count, this->GetLootGUID());
#endif
sScriptMgr->OnLootItem(this, newitem, item->count, this->GetLootGUID());
}
else
@@ -13235,9 +13233,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
m_usedTalentCount += talentPointsChange;
SetFreeTalentPoints(CurTalentPoints - talentPointsChange);
#ifdef ELUNA
sEluna->OnLearnTalents(this, talentId, talentRank, spellId);
#endif
sScriptMgr->OnPlayerLearnTalents(this, talentId, talentRank, spellId);
}
void Player::LearnPetTalent(ObjectGuid petGuid, uint32 talentId, uint32 talentRank)