Merge branch 'azerothcore:master' into Playerbot

This commit is contained in:
ZhengPeiRu21
2022-08-18 13:48:09 -06:00
committed by GitHub
13 changed files with 96 additions and 65 deletions

View File

@@ -2,8 +2,6 @@
CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
IMPORT_DB=$1
source "$CUR_PATH/docker-build-prod.sh"
echo "Fixing EOL..."
@@ -14,5 +12,3 @@ for file in "env/dist/etc/"*
do
dos2unix -n $file $file
done
[[ $IMPORT_DB != 0 ]] && bash acore.sh db-assembler import-all || true

View File

@@ -51,11 +51,11 @@ shellCommandFactory(
shellCommandFactory(
"build:compile",
"Run the compilation process only, without rebuilding all docker images and importing db",
"Run the compilation process only, without rebuilding all docker images",
[
"docker-compose build --parallel ac-build",
"docker image prune -f",
"docker-compose run --rm ac-build bash apps/docker/docker-build-dev.sh 0",
"docker-compose run --rm ac-build bash apps/docker/docker-build-dev.sh",
],
env,
);
@@ -77,13 +77,6 @@ shellCommandFactory(
env,
);
shellCommandFactory(
"db-import",
"Create and upgrade the database with latest updates",
["docker-compose run --rm ac-build bash acore.sh db-assembler import-all"],
env,
);
shellCommandFactory(
"dev:up",
"Start the dev server container in background",

View File

@@ -1880,9 +1880,24 @@ ChatFlood.MessageCount = 10
ChatFlood.MessageDelay = 1
#
# ChatFlood.AddonMessageCount
# Description: Chat flood protection, number of addon messages before player gets muted.
# Default: 100 - (Enabled)
# 0 - (Disabled)
ChatFlood.AddonMessageCount = 100
#
# ChatFlood.AddonMessageDelay
# Description: Time (in seconds) between addon messages to be counted into ChatFlood.AddonMessageCount.
# Default: 1
ChatFlood.AddonMessageDelay = 1
#
# ChatFlood.MuteTime
# Description: Time (in seconds) characters get muted for violating ChatFlood.MessageCount.
# Description: Time (in seconds) characters get muted for violating ChatFlood.MessageCount / ChatFlood.AddonMessageCount.
# Default: 10
ChatFlood.MuteTime = 10

View File

@@ -153,9 +153,6 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this)
#pragma warning(default:4355)
#endif
m_speakTime = 0;
m_speakCount = 0;
m_objectType |= TYPEMASK_PLAYER;
m_objectTypeId = TYPEID_PLAYER;

View File

@@ -2256,9 +2256,21 @@ public:
/*** FLOOD FILTER SYSTEM ***/
/*********************************************************/
void UpdateSpeakTime(uint32 specialMessageLimit = 0);
struct ChatFloodThrottle
{
enum Index
{
REGULAR = 0,
ADDON = 1,
MAX
};
time_t Time = 0;
uint32 Count = 0;
};
void UpdateSpeakTime(ChatFloodThrottle::Index index);
[[nodiscard]] bool CanSpeak() const;
void ChangeSpeakTime(int utime);
/*********************************************************/
/*** VARIOUS SYSTEMS ***/
@@ -2697,8 +2709,7 @@ public:
uint16 m_additionalSaveTimer; // pussywizard
uint8 m_additionalSaveMask; // pussywizard
uint16 m_hostileReferenceCheckTimer; // pussywizard
time_t m_speakTime;
uint32 m_speakCount;
std::array<ChatFloodThrottle, ChatFloodThrottle::MAX> m_chatFloodData;
Difficulty m_dungeonDifficulty;
Difficulty m_raidDifficulty;
Difficulty m_raidMapDifficulty;

View File

@@ -26,34 +26,44 @@
/*** FLOOD FILTER SYSTEM ***/
/*********************************************************/
void Player::UpdateSpeakTime(uint32 specialMessageLimit)
void Player::UpdateSpeakTime(ChatFloodThrottle::Index index)
{
// ignore chat spam protection for GMs in any mode
if (!AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()))
return;
time_t current = GameTime::GetGameTime().count();
if (m_speakTime > current)
uint32 limit, delay;
switch (index)
{
uint32 max_count = specialMessageLimit ? specialMessageLimit : sWorld->getIntConfig(CONFIG_CHATFLOOD_MESSAGE_COUNT);
if (!max_count)
return;
++m_speakCount;
if (m_speakCount >= max_count)
case ChatFloodThrottle::ADDON:
limit = sWorld->getIntConfig(CONFIG_CHATFLOOD_ADDON_MESSAGE_COUNT);
delay = sWorld->getIntConfig(CONFIG_CHATFLOOD_ADDON_MESSAGE_DELAY);
break;
case ChatFloodThrottle::REGULAR:
limit = sWorld->getIntConfig(CONFIG_CHATFLOOD_MESSAGE_COUNT);
delay = sWorld->getIntConfig(CONFIG_CHATFLOOD_MESSAGE_DELAY);
[[fallthrough]];
default:
return;
}
time_t current = GameTime::GetGameTime().count();
if (m_chatFloodData[index].Time > current)
{
++m_chatFloodData[index].Count;
if (m_chatFloodData[index].Count >= limit)
{
// prevent overwrite mute time, if message send just before mutes set, for example.
time_t new_mute = current + sWorld->getIntConfig(CONFIG_CHATFLOOD_MUTE_TIME);
if (GetSession()->m_muteTime < new_mute)
GetSession()->m_muteTime = new_mute;
m_speakCount = 0;
m_chatFloodData[index].Count = 0;
}
}
else
m_speakCount = 1;
m_chatFloodData[index].Count = 1;
m_speakTime = current + sWorld->getIntConfig(CONFIG_CHATFLOOD_MESSAGE_DELAY);
m_chatFloodData[index].Time = current + delay;
}
bool Player::CanSpeak() const

View File

@@ -194,10 +194,8 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
return;
}
}
// LANG_ADDON should not be changed nor be affected by flood control
else
{
uint32 specialMessageLimit = 0;
// send in universal language if player in .gmon mode (ignore spell effects)
if (sender->IsGameMaster())
lang = LANG_UNIVERSAL;
@@ -218,20 +216,12 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
// allow two side chat at group channel if two side group allowed
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
lang = LANG_UNIVERSAL;
specialMessageLimit = 35;
break;
case CHAT_MSG_GUILD:
case CHAT_MSG_OFFICER:
// allow two side chat at guild channel if two side guild allowed
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
lang = LANG_UNIVERSAL;
specialMessageLimit = 15;
break;
case CHAT_MSG_WHISPER:
if (sender->getLevel() >= 80)
specialMessageLimit = 15;
break;
}
}
@@ -242,7 +232,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
}
if (type != CHAT_MSG_AFK && type != CHAT_MSG_DND)
sender->UpdateSpeakTime(specialMessageLimit);
sender->UpdateSpeakTime(lang == LANG_ADDON ? Player::ChatFloodThrottle::ADDON : Player::ChatFloodThrottle::REGULAR);
}
std::string to, channel, msg;
@@ -344,6 +334,11 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
}
}
else
{
++_addonMessageReceiveCount;
}
sScriptMgr->OnBeforeSendChatMessage(_player, type, lang, msg);
switch (type)
@@ -737,7 +732,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData)
if (!GetPlayer()->IsAlive())
return;
GetPlayer()->UpdateSpeakTime();
GetPlayer()->UpdateSpeakTime(Player::ChatFloodThrottle::REGULAR);
if (!GetPlayer()->CanSpeak())
{

View File

@@ -130,6 +130,7 @@ WorldSession::WorldSession(uint32 id, std::string&& name, std::shared_ptr<WorldS
isRecruiter(isARecruiter),
m_currentVendorEntry(0),
_calendarEventCreationCooldown(0),
_addonMessageReceiveCount(0),
_timeSyncClockDeltaQueue(6),
_timeSyncClockDelta(0),
_pendingTimeSyncRequests(),
@@ -459,6 +460,8 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
_recvQueue.readd(requeuePackets.begin(), requeuePackets.end());
METRIC_VALUE("processed_packets", processedPackets);
METRIC_VALUE("addon_messages", _addonMessageReceiveCount.load());
_addonMessageReceiveCount = 0;
if (!updater.ProcessUnsafe()) // <=> updater is of type MapSessionFilter
{

View File

@@ -1206,6 +1206,9 @@ private:
// Packets cooldown
time_t _calendarEventCreationCooldown;
// Addon Message count for Metric
std::atomic<uint32> _addonMessageReceiveCount;
CircularBuffer<std::pair<int64, uint32>> _timeSyncClockDeltaQueue; // first member: clockDelta. Second member: latency of the packet exchange that was used to compute that clockDelta.
int64 _timeSyncClockDelta;
void ComputeNewClockDelta();

View File

@@ -267,6 +267,8 @@ enum WorldIntConfigs
CONFIG_EXPANSION,
CONFIG_CHATFLOOD_MESSAGE_COUNT,
CONFIG_CHATFLOOD_MESSAGE_DELAY,
CONFIG_CHATFLOOD_ADDON_MESSAGE_COUNT,
CONFIG_CHATFLOOD_ADDON_MESSAGE_DELAY,
CONFIG_CHATFLOOD_MUTE_TIME,
CONFIG_EVENT_ANNOUNCE,
CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY,

View File

@@ -1023,6 +1023,8 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_CHATFLOOD_MESSAGE_COUNT] = sConfigMgr->GetOption<int32>("ChatFlood.MessageCount", 10);
m_int_configs[CONFIG_CHATFLOOD_MESSAGE_DELAY] = sConfigMgr->GetOption<int32>("ChatFlood.MessageDelay", 1);
m_int_configs[CONFIG_CHATFLOOD_ADDON_MESSAGE_COUNT] = sConfigMgr->GetOption<int32>("ChatFlood.AddonMessageCount", 100);
m_int_configs[CONFIG_CHATFLOOD_ADDON_MESSAGE_DELAY] = sConfigMgr->GetOption<int32>("ChatFlood.AddonMessageDelay", 1);
m_int_configs[CONFIG_CHATFLOOD_MUTE_TIME] = sConfigMgr->GetOption<int32>("ChatFlood.MuteTime", 10);
m_bool_configs[CONFIG_CHAT_MUTE_FIRST_LOGIN] = sConfigMgr->GetOption<bool>("Chat.MuteFirstLogin", false);
m_int_configs[CONFIG_CHAT_TIME_MUTE_FIRST_LOGIN] = sConfigMgr->GetOption<int32>("Chat.MuteTimeFirstLogin", 120);

View File

@@ -24,13 +24,13 @@
enum Spells
{
SPELL_STINGER_SPRAY = 25749,
SPELL_POISON_STINGER = 25748,
SPELL_PARALYZE = 25725,
SPELL_FRENZY = 8269,
SPELL_LASH = 25852,
SPELL_FEED = 25721,
SPELL_THRASH = 3391,
SPELL_STINGER_SPRAY = 25749,
SPELL_POISON_STINGER = 25748,
SPELL_PARALYZE = 25725,
SPELL_FRENZY = 8269,
SPELL_LASH = 25852,
SPELL_FEED = 25721,
SPELL_THRASH = 3391,
// Server-side spells
SPELL_SUMMON_LARVA_A = 26538,
@@ -53,26 +53,26 @@ enum Spells
enum Misc
{
MAX_SWARMER_COUNT = 28,
ACTION_SWARMER_SWARM = 1,
MAX_SWARMER_COUNT = 28,
ACTION_SWARMER_SWARM = 1,
};
enum Emotes
{
EMOTE_FRENZY = 0
EMOTE_FRENZY = 0
};
enum Phases
{
PHASE_AIR = 0,
PHASE_GROUND = 1
PHASE_AIR = 0,
PHASE_GROUND = 1
};
enum Points
{
POINT_AIR = 0,
POINT_GROUND = 2,
POINT_PARALYZE = 2
POINT_AIR = 0,
POINT_GROUND = 2,
POINT_PARALYZE = 2
};
const Position AyamissAirPos = { -9689.292f, 1547.912f, 48.02729f, 0.0f };
@@ -177,6 +177,12 @@ struct boss_ayamiss : public BossAI
}
}
void JustDied(Unit* killer) override
{
me->GetMotionMaster()->MoveFall();
BossAI::JustDied(killer);
}
void EnterEvadeMode(EvadeReason why) override
{
me->ClearUnitState(UNIT_STATE_ROOT);

View File

@@ -97,12 +97,10 @@ struct boss_buru : public BossAI
ChaseNewVictim();
}
void JustDied(Unit* /*killer*/) override
void JustDied(Unit* killer) override
{
if (InstanceScript* pInstance = me->GetInstanceScript())
{
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_CREEPING_PLAGUE);
}
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_CREEPING_PLAGUE);
BossAI::JustDied(killer);
}
void KilledUnit(Unit* victim) override