Merge pull request #368 from LightyPonce/cathook-NCC
Cathook ncc update
This commit is contained in:
commit
591636680a
@ -23,6 +23,7 @@ public:
|
|||||||
ItemVariable(CatVar &variable);
|
ItemVariable(CatVar &variable);
|
||||||
|
|
||||||
void Change(float amount);
|
void Change(float amount);
|
||||||
|
void PutChar(char ch);
|
||||||
|
|
||||||
virtual void Update() override;
|
virtual void Update() override;
|
||||||
virtual bool ConsumesKey(ButtonCode_t key) override;
|
virtual bool ConsumesKey(ButtonCode_t key) override;
|
||||||
|
@ -288,10 +288,11 @@ static CatVar crypt_chat(
|
|||||||
CV_SWITCH, "chat_crypto", "1", "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", "",
|
||||||
|
"Censor words",
|
||||||
"Spam Chat with newlines if the chosen words are "
|
"Spam Chat with newlines if the chosen words are "
|
||||||
"said, seperate with commas");
|
"said, seperate with commas");
|
||||||
static CatVar chat_filter_enabled(CV_SWITCH, "chat_censor_enabled", "0",
|
static CatVar chat_filter_enabled(CV_SWITCH, "chat_censor_enabled", "0",
|
||||||
"enable censor");
|
"Enable censor");
|
||||||
|
|
||||||
bool SendNetMsg_hook(void *_this, INetMessage &msg, bool bForceReliable = false,
|
bool SendNetMsg_hook(void *_this, INetMessage &msg, bool bForceReliable = false,
|
||||||
bool bVoice = false)
|
bool bVoice = false)
|
||||||
|
@ -24,7 +24,7 @@ void ItemVariable::Update()
|
|||||||
Item::Update();
|
Item::Update();
|
||||||
if (!catvar.desc_long.empty())
|
if (!catvar.desc_long.empty())
|
||||||
if (catvar.desc_long.length() && IsHovered() &&
|
if (catvar.desc_long.length() && IsHovered() &&
|
||||||
catvar.desc_long != "no description")
|
catvar.desc_long != "no description")
|
||||||
ShowTooltip(catvar.desc_long);
|
ShowTooltip(catvar.desc_long);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,8 @@ bool ItemVariable::ConsumesKey(ButtonCode_t key)
|
|||||||
if (capturing)
|
if (capturing)
|
||||||
return true;
|
return true;
|
||||||
if (key == ButtonCode_t::MOUSE_WHEEL_DOWN ||
|
if (key == ButtonCode_t::MOUSE_WHEEL_DOWN ||
|
||||||
key == ButtonCode_t::MOUSE_WHEEL_UP || key == ButtonCode_t::MOUSE_FIRST)
|
key == ButtonCode_t::MOUSE_WHEEL_UP ||
|
||||||
|
key >= ButtonCode_t::KEY_FIRST && key <= ButtonCode_t::KEY_BACKSPACE)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -84,11 +85,16 @@ void ItemVariable::OnFocusLose()
|
|||||||
capturing = false;
|
capturing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ItemVariable::PutChar(char ch)
|
||||||
|
{
|
||||||
|
catvar.SetValue(catvar.GetString() + std::string(1, ch));
|
||||||
|
}
|
||||||
|
|
||||||
void ItemVariable::OnKeyPress(ButtonCode_t key, bool repeat)
|
void ItemVariable::OnKeyPress(ButtonCode_t key, bool repeat)
|
||||||
{
|
{
|
||||||
if (capturing)
|
if (capturing)
|
||||||
{
|
{
|
||||||
if (key == 70)
|
if (key == ButtonCode_t::KEY_ESCAPE)
|
||||||
key = (ButtonCode_t) 0;
|
key = (ButtonCode_t) 0;
|
||||||
catvar = (int) key;
|
catvar = (int) key;
|
||||||
capturing = false;
|
capturing = false;
|
||||||
@ -101,33 +107,69 @@ void ItemVariable::OnKeyPress(ButtonCode_t key, bool repeat)
|
|||||||
{
|
{
|
||||||
case CV_ENUM:
|
case CV_ENUM:
|
||||||
case CV_SWITCH:
|
case CV_SWITCH:
|
||||||
change = 1.0f;
|
case CV_STRING:
|
||||||
break;
|
{
|
||||||
|
if (key == ButtonCode_t::KEY_BACKSPACE)
|
||||||
|
{
|
||||||
|
std::string val = catvar.GetString();
|
||||||
|
if (val.length() > 0)
|
||||||
|
catvar.SetValue(val.substr(0, val.length() - 1));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (key == ButtonCode_t::KEY_SPACE)
|
||||||
|
{
|
||||||
|
PutChar(' ');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char ch = 0;
|
||||||
|
if (g_IInputSystem->IsButtonDown(ButtonCode_t::KEY_LSHIFT) ||
|
||||||
|
g_IInputSystem->IsButtonDown(ButtonCode_t::KEY_RSHIFT))
|
||||||
|
ch = GetUpperChar(key);
|
||||||
|
else
|
||||||
|
ch = GetChar(key);
|
||||||
|
if (ch)
|
||||||
|
PutChar(ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
case CV_INT:
|
case CV_INT:
|
||||||
case CV_FLOAT:
|
case CV_FLOAT:
|
||||||
{
|
{
|
||||||
if (catvar.restricted)
|
if (catvar.restricted)
|
||||||
{
|
|
||||||
change = float(catvar.max - catvar.min) / 50.0f;
|
change = float(catvar.max - catvar.min) / 50.0f;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
change = 1.0f;
|
change = 1.0f;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (catvar.type == CV_STRING)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
if (change < 1.0f && catvar.type == CV_INT)
|
if (change < 1.0f && catvar.type == CV_INT)
|
||||||
change = 1.0f;
|
change = 1.0f;
|
||||||
|
|
||||||
if ((catvar.type == CV_SWITCH && key == ButtonCode_t::MOUSE_FIRST) ||
|
if (key == ButtonCode_t::MOUSE_WHEEL_UP)
|
||||||
key == ButtonCode_t::MOUSE_WHEEL_UP)
|
|
||||||
{
|
{
|
||||||
Change(change);
|
if (catvar.type == CV_FLOAT &&
|
||||||
|
g_IInputSystem->IsButtonDown(ButtonCode_t::KEY_LSHIFT))
|
||||||
|
Change(change * 2);
|
||||||
|
else if (catvar.type == CV_FLOAT &&
|
||||||
|
g_IInputSystem->IsButtonDown(ButtonCode_t::KEY_LCONTROL))
|
||||||
|
Change(change / 4);
|
||||||
|
else
|
||||||
|
Change(change);
|
||||||
}
|
}
|
||||||
else if (key == ButtonCode_t::MOUSE_WHEEL_DOWN)
|
else if (key == ButtonCode_t::MOUSE_WHEEL_DOWN)
|
||||||
{
|
{
|
||||||
Change(-change);
|
if (catvar.type == CV_FLOAT &&
|
||||||
|
g_IInputSystem->IsButtonDown(ButtonCode_t::KEY_LSHIFT))
|
||||||
|
Change(-change * 2);
|
||||||
|
else if (catvar.type == CV_FLOAT &&
|
||||||
|
g_IInputSystem->IsButtonDown(ButtonCode_t::KEY_LCONTROL))
|
||||||
|
Change(-change / 4);
|
||||||
|
else
|
||||||
|
Change(-change);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,6 +627,7 @@ static const std::string list_tf2 = R"(
|
|||||||
"Chat Settings Menu"
|
"Chat Settings Menu"
|
||||||
"spam"
|
"spam"
|
||||||
"killsay"
|
"killsay"
|
||||||
|
"killsay_file"
|
||||||
"spam_teamname"
|
"spam_teamname"
|
||||||
"spam_voicecommand"
|
"spam_voicecommand"
|
||||||
"chat_newlines"
|
"chat_newlines"
|
||||||
@ -643,6 +644,7 @@ static const std::string list_tf2 = R"(
|
|||||||
"Uberspam" [
|
"Uberspam" [
|
||||||
"Uberspam Menu"
|
"Uberspam Menu"
|
||||||
"uberspam"
|
"uberspam"
|
||||||
|
"uberspam_file"
|
||||||
"uberspam_team"
|
"uberspam_team"
|
||||||
"uberspam_build"
|
"uberspam_build"
|
||||||
"uberspam_ended"
|
"uberspam_ended"
|
||||||
@ -652,6 +654,8 @@ static const std::string list_tf2 = R"(
|
|||||||
]
|
]
|
||||||
"Misc" [
|
"Misc" [
|
||||||
"Misc Menu"
|
"Misc Menu"
|
||||||
|
"name"
|
||||||
|
"disconnect_reason"
|
||||||
"pure_bypass"
|
"pure_bypass"
|
||||||
"nolerp"
|
"nolerp"
|
||||||
"info"
|
"info"
|
||||||
|
Reference in New Issue
Block a user