Add more spoofing options and added clang-format (#1020)
* feat(Spoofing): add spoofing * feat(Spoofing): prepare code for player attach * remove(PlayerAttach): isn't going to work due to netsync architecture * fix(GUI): fix scaling * feat(Project): add clang-format file * feat(Classes): update classes * fix(BlackHole): remove unnecessary cleanup * fix(Formatting): fix formatting for initializer lists * feat(clang-format): Set tab width and 1 space before comment Co-authored-by: Yimura <24669514+Yimura@users.noreply.github.com>
This commit is contained in:
@ -1,17 +1,18 @@
|
||||
#include "interloper_reaction.hpp"
|
||||
|
||||
#include "backend/player_command.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "script.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "script.hpp"
|
||||
#include "util/notify.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
interloper_reaction::interloper_reaction(const char* event_name, const char* notify_message, const char* announce_message, bool blockable, bool karmaable) :
|
||||
reaction(event_name, notify_message, announce_message),
|
||||
m_blockable(blockable),
|
||||
m_karmaable(karmaable)
|
||||
reaction(event_name, notify_message, announce_message),
|
||||
m_blockable(blockable),
|
||||
m_karmaable(karmaable)
|
||||
{
|
||||
}
|
||||
|
||||
@ -22,19 +23,25 @@ namespace big
|
||||
|
||||
if (announce_in_chat)
|
||||
{
|
||||
g_fiber_pool->queue_job([attacker, victim, this]
|
||||
{
|
||||
g_fiber_pool->queue_job([attacker, victim, this] {
|
||||
char chat[255];
|
||||
snprintf(chat, sizeof(chat), std::format("{} {}", g.session.chat_output_prefix, m_announce_message).data(), attacker->get_name(), victim->get_name());
|
||||
snprintf(chat,
|
||||
sizeof(chat),
|
||||
std::format("{} {}", g.session.chat_output_prefix, m_announce_message).data(),
|
||||
attacker->get_name(),
|
||||
victim->get_name());
|
||||
|
||||
if (g_hooking->get_original<hooks::send_chat_message>()(*g_pointers->m_send_chat_ptr, g_player_service->get_self()->get_net_data(), chat, false))
|
||||
if (g_hooking->get_original<hooks::send_chat_message>()(*g_pointers->m_send_chat_ptr,
|
||||
g_player_service->get_self()->get_net_data(),
|
||||
chat,
|
||||
false))
|
||||
notify::draw_chat(chat, g_player_service->get_self()->get_name(), false);
|
||||
});
|
||||
}
|
||||
|
||||
if (notify)
|
||||
{
|
||||
char notification[500]{}; // I don't like using sprintf but there isn't an alternative afaik
|
||||
char notification[500]{};// I don't like using sprintf but there isn't an alternative afaik
|
||||
snprintf(notification, sizeof(notification), m_notify_message, attacker->get_name(), victim->get_name());
|
||||
g_notification_service->push_warning("Protections", notification);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ namespace big
|
||||
bool m_blockable;
|
||||
bool m_karmaable;
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(interloper_reaction, announce_in_chat, notify, log, add_to_player_db, block_joins, kick, block, karma) // json doesn't serialize parent fields automatically
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(interloper_reaction, announce_in_chat, notify, log, add_to_player_db, block_joins, kick, block, karma)// json doesn't serialize parent fields automatically
|
||||
|
||||
virtual void process(player_ptr attacker, player_ptr victim);
|
||||
};
|
||||
|
@ -1,18 +1,19 @@
|
||||
#include "reaction.hpp"
|
||||
|
||||
#include "backend/player_command.hpp"
|
||||
#include "services/player_database/player_database_service.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "script.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "script.hpp"
|
||||
#include "services/player_database/player_database_service.hpp"
|
||||
#include "util/notify.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
reaction::reaction(const char* event_name, const char* notify_message, const char* announce_message) :
|
||||
m_event_name(event_name),
|
||||
m_notify_message(notify_message),
|
||||
m_announce_message(announce_message)
|
||||
m_event_name(event_name),
|
||||
m_notify_message(notify_message),
|
||||
m_announce_message(announce_message)
|
||||
{
|
||||
}
|
||||
|
||||
@ -37,8 +38,7 @@ namespace big
|
||||
|
||||
if (kick)
|
||||
{
|
||||
g_fiber_pool->queue_job([player]
|
||||
{
|
||||
g_fiber_pool->queue_job([player] {
|
||||
((player_command*)command::get(RAGE_JOAAT("bailkick")))->call(player, {});
|
||||
((player_command*)command::get(RAGE_JOAAT("nfkick")))->call(player, {});
|
||||
script::get_current()->yield(700ms);
|
||||
@ -54,19 +54,24 @@ namespace big
|
||||
|
||||
if (announce_in_chat)
|
||||
{
|
||||
g_fiber_pool->queue_job([player, this]
|
||||
{
|
||||
g_fiber_pool->queue_job([player, this] {
|
||||
char chat[255];
|
||||
snprintf(chat, sizeof(chat), std::format("{} {}", g.session.chat_output_prefix, m_announce_message).data(), player->get_name());
|
||||
snprintf(chat,
|
||||
sizeof(chat),
|
||||
std::format("{} {}", g.session.chat_output_prefix, m_announce_message).data(),
|
||||
player->get_name());
|
||||
|
||||
if (g_hooking->get_original<hooks::send_chat_message>()(*g_pointers->m_send_chat_ptr, g_player_service->get_self()->get_net_data(), chat, false))
|
||||
if (g_hooking->get_original<hooks::send_chat_message>()(*g_pointers->m_send_chat_ptr,
|
||||
g_player_service->get_self()->get_net_data(),
|
||||
chat,
|
||||
false))
|
||||
notify::draw_chat(chat, g_player_service->get_self()->get_name(), false);
|
||||
});
|
||||
}
|
||||
|
||||
if (notify)
|
||||
{
|
||||
char notification[500]{}; // I don't like using sprintf but there isn't an alternative afaik
|
||||
char notification[500]{};// I don't like using sprintf but there isn't an alternative afaik
|
||||
snprintf(notification, sizeof(notification), m_notify_message, player->get_name());
|
||||
g_notification_service->push_warning("Protections", notification);
|
||||
}
|
||||
|
@ -12,11 +12,11 @@ namespace big
|
||||
|
||||
public:
|
||||
bool announce_in_chat = false;
|
||||
bool notify = true;
|
||||
bool log = true;
|
||||
bool notify = true;
|
||||
bool log = true;
|
||||
bool add_to_player_db = false;
|
||||
bool block_joins = false;
|
||||
bool kick = false;
|
||||
bool block_joins = false;
|
||||
bool kick = false;
|
||||
|
||||
const char* m_event_name;
|
||||
const char* m_notify_message;
|
||||
|
Reference in New Issue
Block a user