Add level restrictions to some commands:
say, yell, emote, whisper, channel use, trade, auction, mail, tickets By azazel. Closes issue #598 --HG-- branch : trunk
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
DELETE FROM `trinity_string` WHERE `entry` IN (6604,6605,6606,6607,6608,6609,6610,6611,6612);
|
||||
INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES
|
||||
(6604, 'You cannot say, yell or emote until you become level %d.'),
|
||||
(6605, 'You cannot whisper until you become level %d.'),
|
||||
(6606, 'You cannot write to channels until you become level %d.'),
|
||||
(6607, 'You cannot use auction until you become level %d.'),
|
||||
(6608, 'You cannot write tickets until you become level %d.'),
|
||||
(6609, 'You cannot trade until you become level %d.'),
|
||||
(6610, 'You cannot trade with characters lower than level %d.'),
|
||||
(6611, 'You cannot send mail until you become level %d.'),
|
||||
(6612, 'You cannot send mail to characters lower than level %d.');
|
||||
@@ -14805,6 +14805,15 @@ INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_
|
||||
(5025, 'Type: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(5026, 'DisplayID: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(5027, 'Name: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(6604, 'You cannot say, yell or emote until you become level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(6605, 'You cannot whisper until you become level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(6606, 'You cannot write to channels until you become level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(6607, 'You cannot use auction until you become level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(6608, 'You cannot write tickets until you become level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(6609, 'You cannot trade until you become level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(6610, 'You cannot trade with characters lower than level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(6611, 'You cannot send mail until you become level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(6612, 'You cannot send mail to characters lower than level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(6613, '|cfff00000[GM Announcement]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(6614, 'Notification to GM''s - ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(6615, '|cffffff00[|c1f40af20GM Announce by|r |cffff0000%s|cffffff00]:|r %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
|
||||
@@ -57,6 +57,12 @@ void WorldSession::HandleAuctionHelloOpcode(WorldPacket & recv_data)
|
||||
//this void causes that auction window is opened
|
||||
void WorldSession::SendAuctionHello(uint64 guid, Creature* unit)
|
||||
{
|
||||
if (GetPlayer()->getLevel() < sWorld.getConfig(CONFIG_AUCTION_LEVEL_REQ))
|
||||
{
|
||||
SendNotification(GetTrinityString(LANG_AUCTION_REQ), sWorld.getConfig(CONFIG_AUCTION_LEVEL_REQ));
|
||||
return;
|
||||
}
|
||||
|
||||
AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit->getFaction());
|
||||
if (!ahEntry)
|
||||
return;
|
||||
|
||||
@@ -199,6 +199,12 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
||||
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
|
||||
break;
|
||||
|
||||
if (_player->getLevel() < sWorld.getConfig(CONFIG_CHAT_SAY_LEVEL_REQ))
|
||||
{
|
||||
SendNotification(GetTrinityString(LANG_SAY_REQ), sWorld.getConfig(CONFIG_CHAT_SAY_LEVEL_REQ));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
@@ -219,6 +225,12 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
||||
recv_data >> to;
|
||||
recv_data >> msg;
|
||||
|
||||
if (_player->getLevel() < sWorld.getConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ))
|
||||
{
|
||||
SendNotification(GetTrinityString(LANG_WHISPER_REQ), sWorld.getConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
@@ -519,8 +531,11 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if (_player->getLevel() < sWorld.getConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ))
|
||||
return;
|
||||
if (_player->getLevel() < sWorld.getConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ))
|
||||
{
|
||||
SendNotification(GetTrinityString(LANG_CHANNEL_REQ), sWorld.getConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ));
|
||||
return;
|
||||
}
|
||||
|
||||
if(msg.empty())
|
||||
break;
|
||||
|
||||
@@ -884,6 +884,19 @@ enum TrinityStrings
|
||||
LANG_GOINFO_DISPLAYID = 5026,
|
||||
LANG_GOINFO_NAME = 5027,
|
||||
// Room for more Trinity strings 5028-9999
|
||||
|
||||
// Level requirement notifications
|
||||
LANG_SAY_REQ = 6604,
|
||||
LANG_WHISPER_REQ = 6605,
|
||||
LANG_CHANNEL_REQ = 6606,
|
||||
LANG_AUCTION_REQ = 6607,
|
||||
LANG_TICKET_REQ = 6608,
|
||||
LANG_TRADE_REQ = 6609,
|
||||
LANG_TRADE_OTHER_REQ = 6610,
|
||||
LANG_MAIL_SENDER_REQ = 6611,
|
||||
LANG_MAIL_RECEIVER_REQ = 6612,
|
||||
|
||||
|
||||
// Used for GM Announcements
|
||||
LANG_GM_BROADCAST = 6613,
|
||||
LANG_GM_NOTIFY = 6614,
|
||||
|
||||
@@ -92,6 +92,12 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
||||
|
||||
Player* pl = _player;
|
||||
|
||||
if (pl->getLevel() < sWorld.getConfig(CONFIG_MAIL_LEVEL_REQ))
|
||||
{
|
||||
SendNotification(GetTrinityString(LANG_MAIL_SENDER_REQ), sWorld.getConfig(CONFIG_MAIL_LEVEL_REQ));
|
||||
return;
|
||||
}
|
||||
|
||||
uint64 rc = 0;
|
||||
if (normalizePlayerName(receiver))
|
||||
rc = objmgr.GetPlayerGUIDByName(receiver);
|
||||
@@ -126,11 +132,13 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
||||
|
||||
uint32 rc_team = 0;
|
||||
uint8 mails_count = 0; //do not allow to send to one player more than 100 mails
|
||||
uint8 receiveLevel = 0;
|
||||
|
||||
if (receive)
|
||||
{
|
||||
rc_team = receive->GetTeam();
|
||||
mails_count = receive->GetMailSize();
|
||||
receiveLevel = receive->getLevel();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -140,6 +148,11 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
||||
Field *fields = result->Fetch();
|
||||
mails_count = fields[0].GetUInt32();
|
||||
}
|
||||
if (QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT level FROM characters WHERE guid = '%u'", GUID_LOPART(rc)))
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
receiveLevel = fields[0].GetUInt8();
|
||||
}
|
||||
}
|
||||
//do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255..
|
||||
if (mails_count > 100)
|
||||
@@ -154,6 +167,12 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
||||
return;
|
||||
}
|
||||
|
||||
if (receiveLevel < sWorld.getConfig(CONFIG_MAIL_LEVEL_REQ))
|
||||
{
|
||||
SendNotification(GetTrinityString(LANG_MAIL_RECEIVER_REQ), sWorld.getConfig(CONFIG_MAIL_LEVEL_REQ));
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 rc_account = receive
|
||||
? receive->GetSession()->GetAccountId()
|
||||
: objmgr.GetPlayerAccountIdByGUID(rc);
|
||||
|
||||
@@ -27,6 +27,12 @@
|
||||
|
||||
void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
if (GetPlayer()->getLevel() < sWorld.getConfig(CONFIG_TICKET_LEVEL_REQ))
|
||||
{
|
||||
SendNotification(GetTrinityString(LANG_TICKET_REQ), sWorld.getConfig(CONFIG_TICKET_LEVEL_REQ));
|
||||
return;
|
||||
}
|
||||
|
||||
if(GM_Ticket *ticket = objmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID()))
|
||||
{
|
||||
WorldPacket data( SMSG_GMTICKET_CREATE, 4 );
|
||||
|
||||
@@ -495,6 +495,12 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetPlayer()->getLevel() < sWorld.getConfig(CONFIG_TRADE_LEVEL_REQ))
|
||||
{
|
||||
SendNotification(GetTrinityString(LANG_TRADE_REQ), sWorld.getConfig(CONFIG_TRADE_LEVEL_REQ));
|
||||
return;
|
||||
}
|
||||
|
||||
recvPacket >> ID;
|
||||
|
||||
Player* pOther = ObjectAccessor::FindPlayer( ID );
|
||||
@@ -553,6 +559,12 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
if (pOther->getLevel() < sWorld.getConfig(CONFIG_TRADE_LEVEL_REQ))
|
||||
{
|
||||
SendNotification(GetTrinityString(LANG_TRADE_OTHER_REQ), sWorld.getConfig(CONFIG_TRADE_LEVEL_REQ));
|
||||
return;
|
||||
}
|
||||
|
||||
// OK start trade
|
||||
_player->pTrader = pOther;
|
||||
pOther->pTrader =_player;
|
||||
|
||||
+7
-1
@@ -602,7 +602,13 @@ void World::LoadConfigSettings(bool reload)
|
||||
m_configs[CONFIG_COMPRESSION] = 1;
|
||||
}
|
||||
m_configs[CONFIG_ADDON_CHANNEL] = sConfig.GetBoolDefault("AddonChannel", true);
|
||||
m_configs[CONFIG_CHAT_CHANNEL_LEVEL_REQ] = sConfig.GetIntDefault("ChannelLevelReq", 1);
|
||||
m_configs[CONFIG_CHAT_CHANNEL_LEVEL_REQ] = sConfig.GetIntDefault("ChatLevelReq.Channel", 1);
|
||||
m_configs[CONFIG_CHAT_WHISPER_LEVEL_REQ] = sConfig.GetIntDefault("ChatLevelReq.Whisper", 1);
|
||||
m_configs[CONFIG_CHAT_SAY_LEVEL_REQ] = sConfig.GetIntDefault("ChatLevelReq.Say", 1);
|
||||
m_configs[CONFIG_TRADE_LEVEL_REQ] = sConfig.GetIntDefault("LevelReq.Trade", 1);
|
||||
m_configs[CONFIG_TICKET_LEVEL_REQ] = sConfig.GetIntDefault("LevelReq.Ticket", 1);
|
||||
m_configs[CONFIG_AUCTION_LEVEL_REQ] = sConfig.GetIntDefault("LevelReq.Auction", 1);
|
||||
m_configs[CONFIG_MAIL_LEVEL_REQ] = sConfig.GetIntDefault("LevelReq.Mail", 1);
|
||||
m_configs[CONFIG_ALLOW_PLAYER_COMMANDS] = sConfig.GetBoolDefault("AllowPlayerCommands", 1);
|
||||
m_configs[CONFIG_GRID_UNLOAD] = sConfig.GetBoolDefault("GridUnload", true);
|
||||
m_configs[CONFIG_INTERVAL_SAVE] = sConfig.GetIntDefault("PlayerSaveInterval", 15 * MINUTE * IN_MILISECONDS);
|
||||
|
||||
@@ -202,6 +202,12 @@ enum WorldConfigs
|
||||
CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY,
|
||||
CONFIG_CHAT_STRICT_LINK_CHECKING_KICK,
|
||||
CONFIG_CHAT_CHANNEL_LEVEL_REQ,
|
||||
CONFIG_CHAT_WHISPER_LEVEL_REQ,
|
||||
CONFIG_CHAT_SAY_LEVEL_REQ,
|
||||
CONFIG_TRADE_LEVEL_REQ,
|
||||
CONFIG_TICKET_LEVEL_REQ,
|
||||
CONFIG_AUCTION_LEVEL_REQ,
|
||||
CONFIG_MAIL_LEVEL_REQ,
|
||||
CONFIG_ALLOW_PLAYER_COMMANDS,
|
||||
CONFIG_CORPSE_DECAY_NORMAL,
|
||||
CONFIG_CORPSE_DECAY_RARE,
|
||||
|
||||
@@ -1164,10 +1164,18 @@ ListenRange.Yell = 300
|
||||
# Default: 0 (join announcement in normal way)
|
||||
# 1 (GM join without announcement)
|
||||
#
|
||||
# ChannelLevelReq
|
||||
# ChatLevelReq.Channel
|
||||
# The required level of character to be able to write in chat channels
|
||||
# Default: 1 (From level 1)
|
||||
#
|
||||
# ChatLevelReq.Whisper
|
||||
# The required level of character to be able to whisper
|
||||
# Default: 1 (From level 1)
|
||||
#
|
||||
# ChatLevelReq.Say
|
||||
# The required level of character to be able to say/yell/emote
|
||||
# Default: 1 (From level 1)
|
||||
#
|
||||
# AllowPlayerCommands
|
||||
# Allowed the players to use commands
|
||||
# Default: 1 (allow)
|
||||
@@ -1182,7 +1190,9 @@ ChatFlood.MessageDelay = 1
|
||||
ChatFlood.MuteTime = 10
|
||||
Channel.RestrictedLfg = 1
|
||||
Channel.SilentlyGMJoin = 0
|
||||
ChannelLevelReq = 1
|
||||
ChatLevelReq.Channel = 1
|
||||
ChatLevelReq.Whisper = 1
|
||||
ChatLevelReq.Say = 1
|
||||
AllowPlayerCommands = 1
|
||||
|
||||
###############################################################################
|
||||
@@ -2146,6 +2156,22 @@ Ra.Secure = 1
|
||||
# to players when they login to a newly created character.
|
||||
# Default: "" - send no text
|
||||
#
|
||||
# LevelReq.Trade
|
||||
# The required level of character to be able to trade
|
||||
# Default: 1 (From level 1)
|
||||
#
|
||||
# LevelReq.Ticket
|
||||
# The required level of character to be able to write tickets
|
||||
# Default: 1 (From level 1)
|
||||
#
|
||||
# LevelReq.Auction
|
||||
# The required level of character to be able to use auction
|
||||
# Default: 1 (From level 1)
|
||||
#
|
||||
# LevelReq.Mail
|
||||
# The required level of character to be able to send and receive mail
|
||||
# Default: 1 (From level 1)
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
PlayerStart.AllReputation = 0
|
||||
@@ -2164,3 +2190,7 @@ ShowKickInWorld = 0
|
||||
RecordUpdateTimeDiffInterval = 60000
|
||||
MinRecordUpdateTimeDiff = 100
|
||||
PlayerStart.String = ""
|
||||
LevelReq.Trade = 1
|
||||
LevelReq.Ticket = 1
|
||||
LevelReq.Auction = 1
|
||||
LevelReq.Mail = 1
|
||||
|
||||
Reference in New Issue
Block a user