Skip to content

Commit

Permalink
add ignoreyellcheck flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ramon-bernardo committed Sep 25, 2021
1 parent 4fa195d commit 252bf61
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions data/XML/groups.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<flag ignoreweaponcheck="1" />
<flag cannotbemuted="1" />
<flag isalwayspremium="1" />
<flag ignoreyellcheck="1" />
</flags>
</group>
<group id="5" name="community manager" access="1" maxdepotitems="0" maxvipentries="200">
Expand Down Expand Up @@ -95,6 +96,7 @@
<flag ignoreweaponcheck="1" />
<flag cannotbemuted="1" />
<flag isalwayspremium="1" />
<flag ignoreyellcheck="1" />
</flags>
</group>
<group id="6" name="god" access="1" maxdepotitems="0" maxvipentries="200">
Expand Down Expand Up @@ -136,6 +138,7 @@
<flag ignoreweaponcheck="1" />
<flag cannotbemuted="1" />
<flag isalwayspremium="1" />
<flag ignoreyellcheck="1" />
</flags>
</group>
</groups>
1 change: 1 addition & 0 deletions src/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ enum PlayerFlags : uint64_t {
PlayerFlag_IgnoreWeaponCheck = static_cast<uint64_t>(1) << 35,
PlayerFlag_CannotBeMuted = static_cast<uint64_t>(1) << 36,
PlayerFlag_IsAlwaysPremium = static_cast<uint64_t>(1) << 37,
PlayerFlag_ignoreYellCheck = static_cast<uint64_t>(1) << 38,
};

enum ReloadTypes_t : uint8_t {
Expand Down
5 changes: 2 additions & 3 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3524,9 +3524,8 @@ bool Game::playerYell(Player* player, const std::string& text)
}

bool isAccessPlayer = player->isAccessPlayer();
bool belowGamemaster = player->getAccountType() < ACCOUNT_TYPE_GAMEMASTER;
uint32_t minimumLevel = g_config.getNumber(ConfigManager::YELL_MINIMUM_LEVEL);
if (player->getLevel() < minimumLevel && (!isAccessPlayer || belowGamemaster)) {
if (player->getLevel() < minimumLevel && (!isAccessPlayer || !player->hasFlag(PlayerFlag_IgnoreYellCheck))) {
if (g_config.getBoolean(ConfigManager::YELL_ALLOW_PREMIUM)) {
if (!player->isPremium()) {
player->sendTextMessage(MESSAGE_STATUS_SMALL, fmt::format("You may not yell unless you have reached level {:d} or have a premium account.", minimumLevel));
Expand All @@ -3538,7 +3537,7 @@ bool Game::playerYell(Player* player, const std::string& text)
}
}

if (belowGamemaster && !isAccessPlayer) {
if (!isAccessPlayer && !player->hasFlag(PlayerFlag_IgnoreYellCheck)) {
Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_YELLTICKS, 30000, 0);
player->addCondition(condition);
}
Expand Down
3 changes: 2 additions & 1 deletion src/groups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ const std::unordered_map<std::string, PlayerFlags> ParsePlayerFlagMap = {
{"ignorespellcheck", PlayerFlag_IgnoreSpellCheck},
{"ignoreweaponcheck", PlayerFlag_IgnoreWeaponCheck},
{"cannotbemuted", PlayerFlag_CannotBeMuted},
{"isalwayspremium", PlayerFlag_IsAlwaysPremium}
{"isalwayspremium", PlayerFlag_IsAlwaysPremium},
{"ignoreyellcheck", PlayerFlag_IgnoreYellCheck}
};

bool Groups::load()
Expand Down
1 change: 1 addition & 0 deletions src/luascript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,7 @@ void LuaScriptInterface::registerFunctions()
registerEnum(PlayerFlag_IgnoreWeaponCheck)
registerEnum(PlayerFlag_CannotBeMuted)
registerEnum(PlayerFlag_IsAlwaysPremium)
registerEnum(PlayerFlag_IgnoreYellCheck)

registerEnum(PLAYERSEX_FEMALE)
registerEnum(PLAYERSEX_MALE)
Expand Down

0 comments on commit 252bf61

Please sign in to comment.