Merge pull request #361 from nullifiedcat/playerlist

Playerlist
This commit is contained in:
BenCat07 2018-03-03 14:20:42 +01:00 committed by GitHub
commit 5329caf597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 301 additions and 222 deletions

View File

@ -22,7 +22,8 @@ enum class k_EState
RAGE,
IPC,
DEVELOPER,
STATE_LAST = DEVELOPER
CAT,
STATE_LAST = CAT
};
extern rgba_t k_Colors[];

BIN
res/idspec.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -378,6 +378,7 @@ void _FASTCALL emoji(CachedEntity *ent)
{
static glez_texture_t textur =
glez_texture_load_png_rgba("/opt/cathook/data/res/atlas.png");
static glez_texture_t idspecific;
auto hit = hitboxcache[ent->m_IDX][0];
Vector hbm, hbx;
if (draw::WorldToScreen(hit->min, hbm) &&
@ -396,6 +397,59 @@ void _FASTCALL emoji(CachedEntity *ent)
if (!textur)
textur = glez_texture_load_png_rgba(
"/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 (emoji_esp == 1)

View File

@ -17,7 +17,8 @@
static CatVar no_invisibility(CV_SWITCH, "no_invis", "0", "Remove Invisibility",
"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!
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 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");
static CatVar chat_filter(CV_STRING, "chat_censor", "",
"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",
"Log dispatched user messages");
std::string clear = "";
static bool firstcall = true;
bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
{
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 *lastname;
static bool retrun = false;
if (data[0] != LOCAL_E->m_IDX) {
if (data[0] != LOCAL_E->m_IDX)
{
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;
}
}
if (chat_filter_enabled && data[0] != LOCAL_E->m_IDX)
{
if (!strcmp(chat_filter.GetString(), ""))
@ -860,10 +865,26 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
}
if (crypt_chat)
{
if (firstcall)
chat_stack::Say("!!meow", false);
firstcall = false;
if (message.find("!!") == 0)
{
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(),
ucccccp::decrypt(message).c_str());
}
@ -936,7 +957,8 @@ int RandomInt_hook(void *_this, int iMinVal, int iMaxVal)
static const RandomInt_t original =
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);
}

View File

@ -119,6 +119,8 @@ rgba_t Color(unsigned steamid)
{
if (AccessData(steamid).state == k_EState::DEVELOPER)
return colors::RainbowCurrent();
if (AccessData(steamid).state == k_EState::CAT)
return colors::RainbowCurrent();
if (AccessData(steamid).color.a)
{
return AccessData(steamid).color;