Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-07-23 18:23:10 +08:00
83 changed files with 320 additions and 247 deletions

View File

@@ -248,19 +248,6 @@ namespace Acore::ChatCommands
ChatCommandBuilder(char const* name, std::vector<ChatCommandBuilder> const& subCommands)
: _name{ ASSERT_NOTNULL(name) }, _data{ std::in_place_type<SubCommandEntry>, subCommands } { }
[[deprecated("char const* parameters to command handlers are deprecated; convert this to a typed argument handler instead")]]
ChatCommandBuilder(char const* name, bool(&handler)(ChatHandler*, char const*), uint32 securityLevel, Acore::ChatCommands::Console allowConsole)
: ChatCommandBuilder(name, handler, AcoreStrings(), securityLevel, allowConsole) { }
template <typename TypedHandler>
[[deprecated("you are using the old-style command format; convert this to the new format ({ name, handler (not a pointer!), permission, Console::(Yes/No) })")]]
ChatCommandBuilder(char const* name, uint32 securityLevel, bool console, TypedHandler* handler, char const*)
: ChatCommandBuilder(name, *handler, AcoreStrings(), securityLevel, static_cast<Acore::ChatCommands::Console>(console)) { }
[[deprecated("you are using the old-style command format; convert this to the new format ({ name, subCommands })")]]
ChatCommandBuilder(char const* name, uint32, bool, std::nullptr_t, char const*, std::vector <ChatCommandBuilder> const& sub)
: ChatCommandBuilder(name, sub) { }
private:
std::string_view _name;
std::variant<InvokerEntry, SubCommandEntry> _data;

View File

@@ -451,7 +451,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
uint32 moneyRew = 0;
Player* player = _session->GetPlayer();
if (player && (player->getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)))
if (player && (player->GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)))
{
moneyRew = quest->GetRewMoneyMaxLevel();
}

View File

@@ -1915,8 +1915,10 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
if (Probability > 40.0f)
Probability = 40.0f;
if (roll_chance_f(std::max(0.0f, Probability)))
CastSpell(victim, 1604, true);
// Daze application
if (sWorld->getBoolConfig(CONFIG_ENABLE_DAZE))
if (roll_chance_f(std::max(0.0f, Probability)))
CastSpell(victim, 1604, true);
}
if (GetTypeId() == TYPEID_PLAYER)
@@ -3054,9 +3056,8 @@ void Unit::SendMeleeAttackStop(Unit* victim)
if (victim)
{
uint8 nowDead = victim->isDead();
data << victim->GetPackGUID();
data << nowDead;
data << (uint32)victim->isDead();
}
SendMessageToSet(&data, true);
LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTOP");

View File

@@ -1506,9 +1506,7 @@ public:
[[nodiscard]] bool IsTotem() const { return m_unitTypeMask & UNIT_MASK_TOTEM; }
[[nodiscard]] bool IsVehicle() const { return m_unitTypeMask & UNIT_MASK_VEHICLE; }
/// @deprecated Use GetLevel() instead!
[[nodiscard]] uint8 getLevel() const { return uint8(GetUInt32Value(UNIT_FIELD_LEVEL)); }
[[nodiscard]] uint8 GetLevel() const { return getLevel(); }
[[nodiscard]] uint8 GetLevel() const { return uint8(GetUInt32Value(UNIT_FIELD_LEVEL)); }
uint8 getLevelForTarget(WorldObject const* /*target*/) const override { return GetLevel(); }
void SetLevel(uint8 lvl, bool showLevelChange = true);
[[nodiscard]] uint8 getRace(bool original = false) const;

View File

@@ -89,9 +89,8 @@ void WorldSession::SendAttackStop(Unit const* enemy)
if (enemy)
{
uint8 nowDead = enemy->isDead();
data << enemy->GetPackGUID(); // must be packed guid
data << nowDead;
data << (uint32)enemy->isDead();
}
SendPacket(&data);
}

View File

@@ -186,6 +186,7 @@ enum WorldBoolConfigs
CONFIG_STRICT_NAMES_PROFANITY,
CONFIG_ALLOWS_RANK_MOD_FOR_PET_HEALTH,
CONFIG_MUNCHING_BLIZZLIKE,
CONFIG_ENABLE_DAZE,
BOOL_CONFIG_VALUE_COUNT
};
@@ -567,7 +568,6 @@ public:
virtual void LoadConfigSettings(bool reload = false) = 0;
virtual void SendWorldText(uint32 string_id, ...) = 0;
virtual void SendWorldTextOptional(uint32 string_id, uint32 flag, ...) = 0;
virtual void SendGlobalText(const char* text, WorldSession* self) = 0;
virtual void SendGMText(uint32 string_id, ...) = 0;
virtual void SendGlobalMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) = 0;
virtual void SendGlobalGMMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) = 0;

View File

@@ -1285,6 +1285,8 @@ void World::LoadConfigSettings(bool reload)
_bool_configs[CONFIG_MUNCHING_BLIZZLIKE] = sConfigMgr->GetOption<bool>("MunchingBlizzlike.Enabled", true);
_bool_configs[CONFIG_ENABLE_DAZE] = sConfigMgr->GetOption<bool>("Daze.Enabled", true);
_int_configs[CONFIG_DAILY_RBG_MIN_LEVEL_AP_REWARD] = sConfigMgr->GetOption<uint32>("DailyRBGArenaPoints.MinLevel", 71);
_int_configs[CONFIG_AUCTION_HOUSE_SEARCH_TIMEOUT] = sConfigMgr->GetOption<uint32>("AuctionHouse.SearchTimeout", 1000);
@@ -2653,24 +2655,6 @@ void World::SendGMText(uint32 string_id, ...)
va_end(ap);
}
/// @deprecated only for debug purpose. Send a System Message to all players (except self if mentioned)
void World::SendGlobalText(const char* text, WorldSession* self)
{
WorldPacket data;
// need copy to prevent corruption by strtok call in LineFromMessage original string
char* buf = strdup(text);
char* pos = buf;
while (char* line = ChatHandler::LineFromMessage(pos))
{
ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
SendGlobalMessage(&data, self);
}
free(buf);
}
/// Send a packet to all players (or players selected team) in the zone (except self if mentioned)
bool World::SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession* self, TeamId teamId)
{

View File

@@ -239,7 +239,6 @@ public:
void LoadConfigSettings(bool reload = false) override;
void SendWorldText(uint32 string_id, ...) override;
void SendGlobalText(const char* text, WorldSession* self) override;
void SendGMText(uint32 string_id, ...) override;
void SendGlobalMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) override;
void SendGlobalGMMessage(WorldPacket const* packet, WorldSession* self = nullptr, TeamId teamId = TEAM_NEUTRAL) override;