mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 12:04:55 +02:00
Implement rule violations, closes #218
This commit is contained in:
@@ -1156,6 +1156,27 @@ void Game::editList(uint id, int doorId, const std::string& text)
|
||||
m_protocolGame->sendEditList(id, doorId, text);
|
||||
}
|
||||
|
||||
void Game::openRuleViolation(const std::string& reporter)
|
||||
{
|
||||
if(!canPerformGameAction())
|
||||
return;
|
||||
m_protocolGame->sendOpenRuleViolation(reporter);
|
||||
}
|
||||
|
||||
void Game::closeRuleViolation(const std::string& reporter)
|
||||
{
|
||||
if(!canPerformGameAction())
|
||||
return;
|
||||
m_protocolGame->sendCloseRuleViolation(reporter);
|
||||
}
|
||||
|
||||
void Game::cancelRuleViolation()
|
||||
{
|
||||
if(!canPerformGameAction())
|
||||
return;
|
||||
m_protocolGame->sendCancelRuleViolation();
|
||||
}
|
||||
|
||||
void Game::reportBug(const std::string& comment)
|
||||
{
|
||||
if(!canPerformGameAction())
|
||||
|
@@ -225,6 +225,11 @@ public:
|
||||
void editText(uint id, const std::string& text);
|
||||
void editList(uint id, int doorId, const std::string& text);
|
||||
|
||||
// rule violations (only gms)
|
||||
void openRuleViolation(const std::string& reporter);
|
||||
void closeRuleViolation(const std::string& reporter);
|
||||
void cancelRuleViolation();
|
||||
|
||||
// reports
|
||||
void reportBug(const std::string& comment);
|
||||
void reportRuleViolation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment);
|
||||
|
@@ -196,6 +196,9 @@ void Client::registerLuaFunctions()
|
||||
g_lua.bindSingletonFunction("g_game", "inspectTrade", &Game::inspectTrade, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "acceptTrade", &Game::acceptTrade, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "rejectTrade", &Game::rejectTrade, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "openRuleViolation", &Game::openRuleViolation, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "closeRuleViolation", &Game::closeRuleViolation, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "cancelRuleViolation", &Game::cancelRuleViolation, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "reportBug", &Game::reportBug, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "reportRuleViolation", &Game::reportRuleViolation, &g_game);
|
||||
g_lua.bindSingletonFunction("g_game", "debugReport", &Game::debugReport, &g_game);
|
||||
|
@@ -204,6 +204,9 @@ namespace Proto {
|
||||
ClientJoinChannel = 152,
|
||||
ClientLeaveChannel = 153,
|
||||
ClientOpenPrivateChannel = 154,
|
||||
ClientOpenRuleViolation = 155,
|
||||
ClientCloseRuleViolation = 156,
|
||||
ClientCancelRuleViolation = 157,
|
||||
ClientCloseNpcChannel = 158,
|
||||
ClientChangeFightModes = 160,
|
||||
ClientAttack = 161,
|
||||
|
@@ -79,6 +79,9 @@ public:
|
||||
void sendJoinChannel(int channelId);
|
||||
void sendLeaveChannel(int channelId);
|
||||
void sendOpenPrivateChannel(const std::string& receiver);
|
||||
void sendOpenRuleViolation(const std::string& reporter);
|
||||
void sendCloseRuleViolation(const std::string& reporter);
|
||||
void sendCancelRuleViolation();
|
||||
void sendCloseNpcChannel();
|
||||
void sendChangeFightModes(Otc::FightModes fightMode, Otc::ChaseModes chaseMode, bool safeFight);
|
||||
void sendAttack(uint creatureId, uint seq);
|
||||
|
@@ -1123,6 +1123,8 @@ void ProtocolGame::parseTalk(const InputMessagePtr& msg)
|
||||
case Otc::MessagePrivateFrom:
|
||||
case Otc::MessageGamemasterBroadcast:
|
||||
case Otc::MessageGamemasterPrivateFrom:
|
||||
case Otc::MessageRVRAnswer:
|
||||
case Otc::MessageRVRContinue:
|
||||
break;
|
||||
case Otc::MessageRVRChannel:
|
||||
msg->getU32();
|
||||
|
@@ -502,6 +502,7 @@ void ProtocolGame::sendTalk(Otc::MessageMode mode, int channelId, const std::str
|
||||
switch(mode) {
|
||||
case Otc::MessagePrivateTo:
|
||||
case Otc::MessageGamemasterPrivateTo:
|
||||
case Otc::MessageRVRAnswer:
|
||||
msg->addString(receiver);
|
||||
break;
|
||||
case Otc::MessageChannel:
|
||||
@@ -549,6 +550,31 @@ void ProtocolGame::sendOpenPrivateChannel(const std::string& receiver)
|
||||
send(msg);
|
||||
}
|
||||
|
||||
void ProtocolGame::sendOpenRuleViolation(const std::string& reporter)
|
||||
{
|
||||
OutputMessagePtr msg(new OutputMessage);
|
||||
msg->addU8(Proto::ClientOpenRuleViolation);
|
||||
msg->addString(reporter);
|
||||
send(msg);
|
||||
}
|
||||
|
||||
void ProtocolGame::sendCloseRuleViolation(const std::string& reporter)
|
||||
{
|
||||
OutputMessagePtr msg(new OutputMessage);
|
||||
msg->addU8(Proto::ClientCloseRuleViolation);
|
||||
msg->addString(reporter);
|
||||
dump << "ProtocolGame::sendCloseRuleViolation" << reporter;
|
||||
send(msg);
|
||||
}
|
||||
|
||||
void ProtocolGame::sendCancelRuleViolation()
|
||||
{
|
||||
OutputMessagePtr msg(new OutputMessage);
|
||||
msg->addU8(Proto::ClientCancelRuleViolation);
|
||||
dump << "ProtocolGame::sendCancelRuleViolation";
|
||||
send(msg);
|
||||
}
|
||||
|
||||
void ProtocolGame::sendCloseNpcChannel()
|
||||
{
|
||||
OutputMessagePtr msg(new OutputMessage);
|
||||
|
Reference in New Issue
Block a user