commit
5329caf597
@ -22,7 +22,8 @@ enum class k_EState
|
|||||||
RAGE,
|
RAGE,
|
||||||
IPC,
|
IPC,
|
||||||
DEVELOPER,
|
DEVELOPER,
|
||||||
STATE_LAST = DEVELOPER
|
CAT,
|
||||||
|
STATE_LAST = CAT
|
||||||
};
|
};
|
||||||
|
|
||||||
extern rgba_t k_Colors[];
|
extern rgba_t k_Colors[];
|
||||||
|
BIN
res/idspec.png
Normal file
BIN
res/idspec.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
@ -378,6 +378,7 @@ void _FASTCALL emoji(CachedEntity *ent)
|
|||||||
{
|
{
|
||||||
static glez_texture_t textur =
|
static glez_texture_t textur =
|
||||||
glez_texture_load_png_rgba("/opt/cathook/data/res/atlas.png");
|
glez_texture_load_png_rgba("/opt/cathook/data/res/atlas.png");
|
||||||
|
static glez_texture_t idspecific;
|
||||||
auto hit = hitboxcache[ent->m_IDX][0];
|
auto hit = hitboxcache[ent->m_IDX][0];
|
||||||
Vector hbm, hbx;
|
Vector hbm, hbx;
|
||||||
if (draw::WorldToScreen(hit->min, hbm) &&
|
if (draw::WorldToScreen(hit->min, hbm) &&
|
||||||
@ -396,6 +397,59 @@ void _FASTCALL emoji(CachedEntity *ent)
|
|||||||
if (!textur)
|
if (!textur)
|
||||||
textur = glez_texture_load_png_rgba(
|
textur = glez_texture_load_png_rgba(
|
||||||
"/opt/cathook/data/res/atlas.png");
|
"/opt/cathook/data/res/atlas.png");
|
||||||
|
player_info_s info;
|
||||||
|
unsigned int steamID;
|
||||||
|
unsigned int steamidarray[32]{};
|
||||||
|
steamidarray[0] = 263966176;
|
||||||
|
steamidarray[1] = 479487126;
|
||||||
|
steamidarray[2] = 840899897;
|
||||||
|
if (g_IEngine->GetPlayerInfo(ent->m_IDX, &info))
|
||||||
|
{
|
||||||
|
steamID = info.friendsID;
|
||||||
|
}
|
||||||
|
if (!idspecific)
|
||||||
|
idspecific = glez_texture_load_png_rgba(
|
||||||
|
"/opt/cathook/data/res/idspec.png");
|
||||||
|
if (idspecific &&
|
||||||
|
playerlist::AccessData(steamID).state ==
|
||||||
|
playerlist::k_EState::CAT)
|
||||||
|
glez_rect_textured(
|
||||||
|
head_scr.x - size / 2, head_scr.y - size / 2, size,
|
||||||
|
size, white, idspecific, 2 * 64, 1 * 64, 64, 64);
|
||||||
|
for (auto i : steamidarray)
|
||||||
|
{
|
||||||
|
if (steamID == i &&
|
||||||
|
playerlist::AccessData(steamID).state ==
|
||||||
|
playerlist::k_EState::CAT)
|
||||||
|
{
|
||||||
|
if (!idspecific)
|
||||||
|
{
|
||||||
|
idspecific = glez_texture_load_png_rgba(
|
||||||
|
"/opt/cathook/data/res/idspec.png");
|
||||||
|
}
|
||||||
|
if (idspecific)
|
||||||
|
{
|
||||||
|
if (i == steamidarray[0])
|
||||||
|
glez_rect_textured(head_scr.x - size / 2,
|
||||||
|
head_scr.y - size / 2,
|
||||||
|
size, size, white,
|
||||||
|
idspecific, 1 * 64,
|
||||||
|
1 * 64, 64, 64);
|
||||||
|
else if (i == steamidarray[1])
|
||||||
|
glez_rect_textured(
|
||||||
|
head_scr.x - size / 2,
|
||||||
|
head_scr.y - size / 2, size, size,
|
||||||
|
white, idspecific, 0, 1 * 64, 64, 64);
|
||||||
|
else if (i == steamidarray[2])
|
||||||
|
glez_rect_textured(head_scr.x - size / 2,
|
||||||
|
head_scr.y - size / 2,
|
||||||
|
size, size, white,
|
||||||
|
idspecific, 2 * 64,
|
||||||
|
1 * 64, 64, 64);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (textur)
|
if (textur)
|
||||||
{
|
{
|
||||||
if (emoji_esp == 1)
|
if (emoji_esp == 1)
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
static CatVar no_invisibility(CV_SWITCH, "no_invis", "0", "Remove Invisibility",
|
static CatVar no_invisibility(CV_SWITCH, "no_invis", "0", "Remove Invisibility",
|
||||||
"Useful with chams!");
|
"Useful with chams!");
|
||||||
static CatVar medal_flip(CV_SWITCH, "medal_flip", "0", "Infinite Medal Flip", "");
|
static CatVar medal_flip(CV_SWITCH, "medal_flip", "0", "Infinite Medal Flip",
|
||||||
|
"");
|
||||||
|
|
||||||
// This hook isn't used yet!
|
// This hook isn't used yet!
|
||||||
int C_TFPlayer__DrawModel_hook(IClientEntity *_this, int flags)
|
int C_TFPlayer__DrawModel_hook(IClientEntity *_this, int flags)
|
||||||
@ -284,7 +285,7 @@ static CatVar newlines_msg(CV_INT, "chat_newlines", "0", "Prefix newlines",
|
|||||||
|
|
||||||
static CatVar airstuck(CV_KEY, "airstuck", "0", "Airstuck");
|
static CatVar airstuck(CV_KEY, "airstuck", "0", "Airstuck");
|
||||||
static CatVar crypt_chat(
|
static CatVar crypt_chat(
|
||||||
CV_SWITCH, "chat_crypto", "0", "Crypto chat",
|
CV_SWITCH, "chat_crypto", "1", "Crypto chat",
|
||||||
"Start message with !! and it will be only visible to cathook users");
|
"Start message with !! and it will be only visible to cathook users");
|
||||||
static CatVar chat_filter(CV_STRING, "chat_censor", "",
|
static CatVar chat_filter(CV_STRING, "chat_censor", "",
|
||||||
"Spam Chat with newlines if the chosen words are "
|
"Spam Chat with newlines if the chosen words are "
|
||||||
@ -659,6 +660,7 @@ static CatVar clean_chat(CV_SWITCH, "clean_chat", "0", "Clean chat",
|
|||||||
static CatVar dispatch_log(CV_SWITCH, "debug_log_usermessages", "0",
|
static CatVar dispatch_log(CV_SWITCH, "debug_log_usermessages", "0",
|
||||||
"Log dispatched user messages");
|
"Log dispatched user messages");
|
||||||
std::string clear = "";
|
std::string clear = "";
|
||||||
|
static bool firstcall = true;
|
||||||
bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
|
bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
|
||||||
{
|
{
|
||||||
int loop_index, s, i, j;
|
int loop_index, s, i, j;
|
||||||
@ -696,12 +698,15 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
|
|||||||
static const char *lastfilter;
|
static const char *lastfilter;
|
||||||
static const char *lastname;
|
static const char *lastname;
|
||||||
static bool retrun = false;
|
static bool retrun = false;
|
||||||
if (data[0] != LOCAL_E->m_IDX) {
|
if (data[0] != LOCAL_E->m_IDX)
|
||||||
|
{
|
||||||
if (retrun)
|
if (retrun)
|
||||||
PrintChat("\x07%06X%s\x01: \x07%06X%s\x01", 0xe05938, lastname,
|
{
|
||||||
0xefec1f, lastfilter);
|
PrintChat("\x07%06X%s\x01: \x07%06X%s\x01", 0xe05938,
|
||||||
}
|
lastname, 0xefec1f, lastfilter);
|
||||||
retrun = false;
|
retrun = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (chat_filter_enabled && data[0] != LOCAL_E->m_IDX)
|
if (chat_filter_enabled && data[0] != LOCAL_E->m_IDX)
|
||||||
{
|
{
|
||||||
if (!strcmp(chat_filter.GetString(), ""))
|
if (!strcmp(chat_filter.GetString(), ""))
|
||||||
@ -860,10 +865,26 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
|
|||||||
}
|
}
|
||||||
if (crypt_chat)
|
if (crypt_chat)
|
||||||
{
|
{
|
||||||
|
if (firstcall)
|
||||||
|
chat_stack::Say("!!meow", false);
|
||||||
|
firstcall = false;
|
||||||
if (message.find("!!") == 0)
|
if (message.find("!!") == 0)
|
||||||
{
|
{
|
||||||
if (ucccccp::validate(message))
|
if (ucccccp::validate(message))
|
||||||
{
|
{
|
||||||
|
CachedEntity *entity = ENTITY(data[0]);
|
||||||
|
if (CE_GOOD(entity))
|
||||||
|
{
|
||||||
|
if (boost::algorithm::contains(
|
||||||
|
ucccccp::decrypt(message), "meow"))
|
||||||
|
{
|
||||||
|
player_info_s info;
|
||||||
|
g_IEngine->GetPlayerInfo(data[0], &info);
|
||||||
|
unsigned steamid = info.friendsID;
|
||||||
|
playerlist::AccessData(steamid).state =
|
||||||
|
playerlist::k_EState::CAT;
|
||||||
|
}
|
||||||
|
}
|
||||||
PrintChat("\x07%06X%s\x01: %s", 0xe05938, name.c_str(),
|
PrintChat("\x07%06X%s\x01: %s", 0xe05938, name.c_str(),
|
||||||
ucccccp::decrypt(message).c_str());
|
ucccccp::decrypt(message).c_str());
|
||||||
}
|
}
|
||||||
@ -936,7 +957,8 @@ int RandomInt_hook(void *_this, int iMinVal, int iMaxVal)
|
|||||||
static const RandomInt_t original =
|
static const RandomInt_t original =
|
||||||
RandomInt_t(hooks::vstd.GetMethod(offsets::RandomInt()));
|
RandomInt_t(hooks::vstd.GetMethod(offsets::RandomInt()));
|
||||||
|
|
||||||
if (medal_flip && iMinVal == 0 && iMaxVal == 9) return 0;
|
if (medal_flip && iMinVal == 0 && iMaxVal == 9)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return original(_this, iMinVal, iMaxVal);
|
return original(_this, iMinVal, iMaxVal);
|
||||||
}
|
}
|
@ -1,35 +1,35 @@
|
|||||||
/*
|
/*
|
||||||
* playerlist.cpp
|
* playerlist.cpp
|
||||||
*
|
*
|
||||||
* Created on: Apr 11, 2017
|
* Created on: Apr 11, 2017
|
||||||
* Author: nullifiedcat
|
* Author: nullifiedcat
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "playerlist.hpp"
|
#include "playerlist.hpp"
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
namespace playerlist
|
namespace playerlist
|
||||||
{
|
{
|
||||||
|
|
||||||
std::unordered_map<unsigned, userdata> data{};
|
std::unordered_map<unsigned, userdata> data{};
|
||||||
|
|
||||||
const userdata null_data{};
|
const userdata null_data{};
|
||||||
|
|
||||||
rgba_t k_Colors[] = { colors::empty, colors::FromRGBA8(99, 226, 161, 255),
|
rgba_t k_Colors[] = { colors::empty, colors::FromRGBA8(99, 226, 161, 255),
|
||||||
colors::FromRGBA8(226, 204, 99, 255),
|
colors::FromRGBA8(226, 204, 99, 255),
|
||||||
colors::FromRGBA8(232, 134, 6, 255), colors::empty };
|
colors::FromRGBA8(232, 134, 6, 255), colors::empty };
|
||||||
|
|
||||||
bool ShouldSave(const userdata &data)
|
bool ShouldSave(const userdata &data)
|
||||||
{
|
{
|
||||||
return data.color || (data.state != k_EState::DEFAULT);
|
return data.color || (data.state != k_EState::DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Save()
|
void Save()
|
||||||
{
|
{
|
||||||
DIR *cathook_directory = opendir(DATA_PATH);
|
DIR *cathook_directory = opendir(DATA_PATH);
|
||||||
if (!cathook_directory)
|
if (!cathook_directory)
|
||||||
{
|
{
|
||||||
@ -68,10 +68,10 @@ void Save()
|
|||||||
{
|
{
|
||||||
logging::Info("Writing unsuccessful: %s", e.what());
|
logging::Info("Writing unsuccessful: %s", e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Load()
|
void Load()
|
||||||
{
|
{
|
||||||
data.clear();
|
data.clear();
|
||||||
DIR *cathook_directory = opendir(DATA_PATH);
|
DIR *cathook_directory = opendir(DATA_PATH);
|
||||||
if (!cathook_directory)
|
if (!cathook_directory)
|
||||||
@ -113,12 +113,14 @@ void Load()
|
|||||||
{
|
{
|
||||||
logging::Info("Reading unsuccessful: %s", e.what());
|
logging::Info("Reading unsuccessful: %s", e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rgba_t Color(unsigned steamid)
|
rgba_t Color(unsigned steamid)
|
||||||
{
|
{
|
||||||
if (AccessData(steamid).state == k_EState::DEVELOPER)
|
if (AccessData(steamid).state == k_EState::DEVELOPER)
|
||||||
return colors::RainbowCurrent();
|
return colors::RainbowCurrent();
|
||||||
|
if (AccessData(steamid).state == k_EState::CAT)
|
||||||
|
return colors::RainbowCurrent();
|
||||||
if (AccessData(steamid).color.a)
|
if (AccessData(steamid).color.a)
|
||||||
{
|
{
|
||||||
return AccessData(steamid).color;
|
return AccessData(steamid).color;
|
||||||
@ -127,17 +129,17 @@ rgba_t Color(unsigned steamid)
|
|||||||
{
|
{
|
||||||
return k_Colors[static_cast<int>(AccessData(steamid).state)];
|
return k_Colors[static_cast<int>(AccessData(steamid).state)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rgba_t Color(CachedEntity *player)
|
rgba_t Color(CachedEntity *player)
|
||||||
{
|
{
|
||||||
if (CE_GOOD(player))
|
if (CE_GOOD(player))
|
||||||
return Color(player->player_info.friendsID);
|
return Color(player->player_info.friendsID);
|
||||||
return colors::empty;
|
return colors::empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
userdata &AccessData(unsigned steamid)
|
userdata &AccessData(unsigned steamid)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return data.at(steamid);
|
return data.at(steamid);
|
||||||
@ -147,33 +149,33 @@ userdata &AccessData(unsigned steamid)
|
|||||||
data.emplace(steamid, userdata{});
|
data.emplace(steamid, userdata{});
|
||||||
return data.at(steamid);
|
return data.at(steamid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assume player is non-null
|
// Assume player is non-null
|
||||||
userdata &AccessData(CachedEntity *player)
|
userdata &AccessData(CachedEntity *player)
|
||||||
{
|
{
|
||||||
if (CE_GOOD(player))
|
if (CE_GOOD(player))
|
||||||
return AccessData(player->player_info.friendsID);
|
return AccessData(player->player_info.friendsID);
|
||||||
return AccessData(0U);
|
return AccessData(0U);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsDefault(unsigned steamid)
|
bool IsDefault(unsigned steamid)
|
||||||
{
|
{
|
||||||
const userdata &data = AccessData(steamid);
|
const userdata &data = AccessData(steamid);
|
||||||
return data.state == k_EState::DEFAULT && !data.color.a;
|
return data.state == k_EState::DEFAULT && !data.color.a;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsDefault(CachedEntity *entity)
|
bool IsDefault(CachedEntity *entity)
|
||||||
{
|
{
|
||||||
if (CE_GOOD(entity))
|
if (CE_GOOD(entity))
|
||||||
return IsDefault(entity->player_info.friendsID);
|
return IsDefault(entity->player_info.friendsID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CatCommand pl_save("pl_save", "Save playerlist", Save);
|
CatCommand pl_save("pl_save", "Save playerlist", Save);
|
||||||
CatCommand pl_load("pl_load", "Load playerlist", Load);
|
CatCommand pl_load("pl_load", "Load playerlist", Load);
|
||||||
|
|
||||||
CatCommand pl_set_state(
|
CatCommand pl_set_state(
|
||||||
"pl_set_state",
|
"pl_set_state",
|
||||||
"pl_set_state uniqueid state\nfor example pl_set_state 306902159 0",
|
"pl_set_state uniqueid state\nfor example pl_set_state 306902159 0",
|
||||||
[](const CCommand &args) {
|
[](const CCommand &args) {
|
||||||
@ -191,7 +193,7 @@ CatCommand pl_set_state(
|
|||||||
logging::Info("Set %d to %d", steamid, state);
|
logging::Info("Set %d to %d", steamid, state);
|
||||||
});
|
});
|
||||||
|
|
||||||
CatCommand pl_set_color("pl_set_color", "pl_set_color uniqueid r g b",
|
CatCommand pl_set_color("pl_set_color", "pl_set_color uniqueid r g b",
|
||||||
[](const CCommand &args) {
|
[](const CCommand &args) {
|
||||||
if (args.ArgC() < 5)
|
if (args.ArgC() < 5)
|
||||||
{
|
{
|
||||||
@ -208,7 +210,7 @@ CatCommand pl_set_color("pl_set_color", "pl_set_color uniqueid r g b",
|
|||||||
logging::Info("Changed %d's color", steamid);
|
logging::Info("Changed %d's color", steamid);
|
||||||
});
|
});
|
||||||
|
|
||||||
CatCommand pl_info("pl_info", "pl_info uniqueid", [](const CCommand &args) {
|
CatCommand pl_info("pl_info", "pl_info uniqueid", [](const CCommand &args) {
|
||||||
if (args.ArgC() < 2)
|
if (args.ArgC() < 2)
|
||||||
{
|
{
|
||||||
logging::Info("Invalid call");
|
logging::Info("Invalid call");
|
||||||
@ -221,5 +223,5 @@ CatCommand pl_info("pl_info", "pl_info uniqueid", [](const CCommand &args) {
|
|||||||
if (clr) {
|
if (clr) {
|
||||||
ConColorMsg(*reinterpret_cast<::Color*>(&clr), "[CUSTOM COLOR]\n");
|
ConColorMsg(*reinterpret_cast<::Color*>(&clr), "[CUSTOM COLOR]\n");
|
||||||
}*/
|
}*/
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user