From b670d247008f5a465fec226bd95c2362f73f858c Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Sat, 28 Jul 2018 23:17:32 +0300 Subject: [PATCH] almost none left --- src/PlayerTools.cpp | 50 +++++++++++++----------------------- src/hack.cpp | 5 +--- src/hacks/Backtrack.cpp | 20 ++++++--------- src/helpers.cpp | 8 +++--- src/hitrate.cpp | 5 ++-- src/ipc.cpp | 9 +++---- src/prediction.cpp | 13 +++++----- src/tfmm.cpp | 9 +++---- src/visual/fidgetspinner.cpp | 22 ++++++---------- src/votelogger.cpp | 41 ++++------------------------- 10 files changed, 61 insertions(+), 121 deletions(-) diff --git a/src/PlayerTools.cpp b/src/PlayerTools.cpp index 395404a7..0f41f810 100644 --- a/src/PlayerTools.cpp +++ b/src/PlayerTools.cpp @@ -7,39 +7,25 @@ #include #include #include +#include #include "PlayerTools.hpp" #include "entitycache.hpp" +static settings::Int betrayal_limit{ "player-tools.betrayal-limit", "true" }; + +static settings::Bool taunting{ "player-tools.ignore.taunting", "true" }; +static settings::Bool hoovy{ "player-tools.ignore.hoovy", "true" }; + +static settings::Bool online_notarget{ "player-tools.ignore.online.notarget", "true" }; +static settings::Bool online_friendly_software{ "player-tools.ignore.online.friendly-software", "true" }; +static settings::Bool online_only_verified{ "player-tools.ignore.online.only-verified-accounts", "true" }; +static settings::Bool online_anonymous{ "player-tools.ignore.online.anonymous", "true" }; + static std::unordered_map betrayal_list{}; static CatCommand forgive_all("pt_forgive_all", "Clear betrayal list", []() { betrayal_list.clear(); }); -namespace settings -{ - -static CatVar online_notarget(CV_SWITCH, "pt_ignore_notarget", "1", - "Ignore notarget", - "Ignore online players with notarget role"); -static CatVar hoovy(CV_SWITCH, "pt_ignore_hoovy", "1", "Ignore hoovy"); -static CatVar online_friendly_software(CV_SWITCH, "pt_ignore_friendly_software", - "1", "Ignore friendly software", - "Ignore CO-compatible software"); -static CatVar online_only_verified(CV_SWITCH, "pt_ignore_only_verified", "0", - "Only ignore verified", - "If online checks are enabled, only apply " - "ignore if SteamID is verified (not " - "recommended right now)"); -static CatVar online_anonymous(CV_SWITCH, "pt_ignore_anonymous", "1", - "Ignore anonymous", - "Apply ignore checks to anonymous accounts too"); -static CatVar betrayal_limit( - CV_INT, "pt_betrayal_limit", "3", "Betrayal limit", - "Stop ignoring a player after N kills while you ignored them"); -static CatVar taunting(CV_SWITCH, "pt_ignore_taunting", "1", "Ignore taunting", - "Don't shoot taunting players"); -} - namespace player_tools { @@ -48,9 +34,9 @@ IgnoreReason shouldTargetSteamId(unsigned id) if (id == 0) return IgnoreReason::DO_NOT_IGNORE; - if (settings::betrayal_limit) + if (betrayal_limit) { - if (betrayal_list[id] > int(settings::betrayal_limit)) + if (betrayal_list[id] > int(betrayal_limit)) return IgnoreReason::DO_NOT_IGNORE; } @@ -62,14 +48,14 @@ IgnoreReason shouldTargetSteamId(unsigned id) if (co) { bool check_verified = - !settings::online_only_verified || co->is_steamid_verified; - bool check_anonymous = settings::online_anonymous || !co->is_anonymous; + !online_only_verified || co->is_steamid_verified; + bool check_anonymous = online_anonymous || !co->is_anonymous; if (check_verified && check_anonymous) { - if (settings::online_notarget && co->no_target) + if (online_notarget && co->no_target) return IgnoreReason::ONLINE_NO_TARGET; - if (settings::online_friendly_software && + if (online_friendly_software && co->is_using_friendly_software) return IgnoreReason::ONLINE_FRIENDLY_SOFTWARE; } @@ -84,7 +70,7 @@ IgnoreReason shouldTarget(CachedEntity *entity) { if (entity->m_Type() == ENTITY_PLAYER) { - if (settings::hoovy && IsHoovy(entity)) + if (hoovy && IsHoovy(entity)) return IgnoreReason::IS_HOOVY; if (settings::taunting && HasCondition(entity)) return IgnoreReason::IS_TAUNTING; diff --git a/src/hack.cpp b/src/hack.cpp index 6338628c..8f55f678 100644 --- a/src/hack.cpp +++ b/src/hack.cpp @@ -106,10 +106,7 @@ std::stack &hack::command_stack() */ #define red 184, 56, 59, 255 #define blu 88, 133, 162, 255 -static CatVar cat_event_hurt(CV_SWITCH, "cat_event_hurt", "1", - "Enable OnHurt Event", - "Disable if your chat gets spammed with \"blah " - "damaged blah down to blah hp\""); + class AdvancedEventListener : public IGameEventListener { public: diff --git a/src/hacks/Backtrack.cpp b/src/hacks/Backtrack.cpp index 32a0d392..c712faa6 100644 --- a/src/hacks/Backtrack.cpp +++ b/src/hacks/Backtrack.cpp @@ -9,20 +9,16 @@ #include "hacks/Backtrack.hpp" #include #include +#include + +static settings::Bool enable{ "backtrack.enable", "false" }; +static settings::Bool draw_bt{ "backtrack.draw", "false" }; +static settings::Float latency{ "backtrack.latency", "false" }; +static settings::Float mindistance{ "backtrack.min-distance", "false" }; +static settings::Int slots{ "backtrack.slots", "false" }; + namespace hacks::shared::backtrack { -CatVar enable(CV_SWITCH, "backtrack", "0", "Enable backtrack", - "For legit play only as of right now."); -static CatVar draw_bt(CV_SWITCH, "backtrack_draw", "0", "Draw", - "Draw backtrack ticks"); -CatVar latency(CV_FLOAT, "backtrack_latency", "0", "fake lantency", - "Set fake latency to this many ms"); -static CatVar mindistance(CV_FLOAT, "mindistance", "60", "mindistance"); -static CatEnum slots_enum({ "All", "Primary", "Secondary", "Melee", - "Primary Secondary", "Primary Melee", - "Secondary Melee" }); -static CatVar slots(slots_enum, "backtrack_slots", "0", "Enabled Slots", - "Select what slots backtrack should be enabled on."); BacktrackData headPositions[32][66]{}; BestTickData sorted_ticks[66]{}; diff --git a/src/helpers.cpp b/src/helpers.cpp index 676e2a6a..62bc7c14 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -8,6 +8,9 @@ #include "common.hpp" #include +#include + +static settings::Bool tcm{ "debug.tcm", "true" }; std::vector &RegisteredVarsList() { @@ -52,8 +55,7 @@ void BeginConVars() void EndConVars() { - logging::Info("Registering ConVars"); - RegisterCatVars(); + logging::Info("Registering CatCommands"); RegisterCatCommands(); ConVar_Register(); @@ -739,8 +741,6 @@ bool IsEntityVisible(CachedEntity *entity, int hb) } } -static CatVar tcm(CV_SWITCH, "debug_tcm", "1", "TCM"); - std::mutex trace_lock; bool IsEntityVectorVisible(CachedEntity *entity, Vector endpos) { diff --git a/src/hitrate.cpp b/src/hitrate.cpp index d4035afa..db77c73d 100644 --- a/src/hitrate.cpp +++ b/src/hitrate.cpp @@ -7,9 +7,12 @@ #include "common.hpp" #include +#include #include "MiscTemporary.hpp" #include "init.hpp" +static settings::Bool hitrate_check{ "hitrate.enable", "true" }; + namespace hitrate { @@ -20,8 +23,6 @@ int count_shots{ 0 }; int count_hits{ 0 }; int count_hits_head{ 0 }; -CatVar hitrate_check(CV_SWITCH, "hitrate", "1", "Monitor hitrate"); - std::vector> shots{}; diff --git a/src/ipc.cpp b/src/ipc.cpp index b2751ebc..7b8c79b1 100644 --- a/src/ipc.cpp +++ b/src/ipc.cpp @@ -6,6 +6,7 @@ */ #include +#include #include "ipc.hpp" #include "common.hpp" @@ -14,6 +15,9 @@ #if ENABLE_IPC +static settings::Bool ipc_update_list{ "ipc.update-player-list", "true" }; +static settings::String server_name{ "ipc.server", "cathook_followbot_server" }; + namespace ipc { @@ -129,8 +133,6 @@ CatCommand exec_all("ipc_exec_all", "Execute command (on every peer)", 0, 0); } }); -CatVar server_name(CV_STRING, "ipc_server", "cathook_followbot_server", - "IPC server name"); peer_t *peer{ nullptr }; @@ -274,9 +276,6 @@ void Heartbeat() data.heartbeat = time(nullptr); } -static CatVar ipc_update_list(CV_SWITCH, "ipc_update_list", "1", - "IPC Auto-Ignore", - "Automaticly assign playerstates for bots"); void UpdatePlayerlist() { if (peer && ipc_update_list) diff --git a/src/prediction.cpp b/src/prediction.cpp index 4c9577c1..aa1ab31b 100644 --- a/src/prediction.cpp +++ b/src/prediction.cpp @@ -6,8 +6,13 @@ */ #include +#include #include "common.hpp" +static settings::Bool debug_enginepred{ "debug.engine-pred-others", "false" }; +static settings::Bool debug_pp_extrapolate{ "debug.pp-extrapolate", "false" }; +static settings::Bool debug_pp_rockettimeping{ "debug.pp-rocket-time-ping", "false" }; + // TODO there is a Vector() object created each call. Vector SimpleLatencyPrediction(CachedEntity *ent, int hb) @@ -46,8 +51,6 @@ std::vector> predicted_players{}; int predicted_player_count = 0; -static CatVar debug_enginepred(CV_SWITCH, "debug_engine_pred_others", "0", - "DO NOT USE - MOVEMENT"); void Prediction_CreateMove() { @@ -252,11 +255,7 @@ Vector ProjectilePrediction_Engine(CachedEntity *ent, int hb, float speed, return result; } -static CatVar debug_pp_extrapolate( - CV_SWITCH, "debug_pp_extrapolate", "0", - "Extrapolate entity position when predicting projectiles"); -static CatVar debug_pp_rockettimeping(CV_SWITCH, "debug_pp_rocket_time_ping", - "0", "Compensate for ping in pp"); + Vector ProjectilePrediction(CachedEntity *ent, int hb, float speed, float gravitymod, float entgmod) diff --git a/src/tfmm.cpp b/src/tfmm.cpp index 63eb8827..1d669a3c 100644 --- a/src/tfmm.cpp +++ b/src/tfmm.cpp @@ -5,6 +5,7 @@ * Author: nullifiedcat */ +#include #include "common.hpp" #include "hacks/AutoJoin.hpp" @@ -24,13 +25,11 @@ CatCommand get_state("mm_state", "Get party state", []() { logging::Info("State: %d", re::CTFParty::state_(party)); }); +settings::Int queue{ "autoqueue_mode", "7" }; + namespace tfmm { -CatEnum queue_mode({ "MvmPractice", "MvmMannup", "LadderMatch6v6", - "LadderMatch9v9", "LadderMatch12v12", "CasualMatch6v6", - "CasualMatch9v9", "CasualMatch12v12", - "CompetitiveEventMatch12v12" }); -CatVar queue(queue_mode, "autoqueue_mode", "7", "Autoqueue for this mode", ""); + void queue_start() { re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient(); diff --git a/src/visual/fidgetspinner.cpp b/src/visual/fidgetspinner.cpp index b67691ab..45d46c40 100644 --- a/src/visual/fidgetspinner.cpp +++ b/src/visual/fidgetspinner.cpp @@ -11,13 +11,17 @@ #include #include +#include #ifndef FEATURE_FIDGET_SPINNER_ENABLED -static CatVar enable_spinner(CV_SWITCH, "fidgetspinner", "0", "Fidget Spinner", - "Part of Cathook Autism Awareness program"); -CatVar v9mode(CV_SWITCH, "nullcore_mode", "0", "Nullcore mode", - "Part of Cathook Autism Awareness program"); +static settings::Bool enable_spinner{ "visuals.fidget-spinner.enable", "false" }; +static settings::Bool v9mode{ "visuals.fidget-spinner.v952-mode", "false" }; +static settings::Float spinner_speed_cap{ "visuals.fidget-spinner.speed-cap", "30" }; +static settings::Float spinner_speed_scale{ "visuals.fidget-spinner.speed-scale", "0.03" }; +static settings::Float spinner_decay_speed{ "visuals.fidget-spinner.decay-speed", "0.1" }; +static settings::Float spinner_scale{ "visuals.fidget-spinner.scale", "32" }; +static settings::Float spinner_min_speed{ "visuals.fidget-spinner.min-speed", "2" }; float spinning_speed = 0.0f; float angle = 0; @@ -53,16 +57,6 @@ void InitSpinner() g_IGameEventManager->AddListener(&listener, false); } -static CatVar spinner_speed_cap(CV_FLOAT, "fidgetspinner_speed_cap", "30", - "Speed cap"); -static CatVar spinner_speed_scale(CV_FLOAT, "fidgetspinner_speed_scale", "0.03", - "Speed scale"); -static CatVar spinner_decay_speed(CV_FLOAT, "fidgetspinner_decay_speed", "0.1", - "Decay speed"); -static CatVar spinner_scale(CV_FLOAT, "fidgetspinner_scale", "32", - "Spinner Size"); -static CatVar spinner_min_speed(CV_FLOAT, "fidgetspinner_min_speed", "2", - "Spinner Min Speed"); Timer retrytimer{}; diff --git a/src/votelogger.cpp b/src/votelogger.cpp index e88b03d2..1812f98e 100644 --- a/src/votelogger.cpp +++ b/src/votelogger.cpp @@ -7,26 +7,14 @@ #include "common.hpp" #include +#include + +static settings::Bool enable{ "vote-log.enable", "false" }; +static settings::Bool requeue{ "vote-log.requeue", "false" }; namespace votelogger { -static CatVar enabled(CV_SWITCH, "votelog", "0", "Log votes"); -static CatVar requeue(CV_SWITCH, "votelog_requeue", "1", - "Auto requeue on vote kick", "Auto requeue on vote kick"); -static CatVar anti_votekick(CV_SWITCH, "anti_votekick", "0", "anti-votekick", - "Prevent votekicks by lagging the server in a way " - "that every vote comes is delayed.\ndo not forget " - "to enable votelog and that this\nmakes the server " - "be down for about 30 seconds\ncl_timeout 60 is a " - "must"); -static CatVar kick_msg(CV_STRING, "anti_votekick_string", - "Everyone thank $NAME for initiating the votekick! The " - "server will now be shut down!", - "anti-votekick message", - "Send this message on Votekick attempts against " - "you.\n$NAME gets replaced with their name\n$CLASS with " - "their class."); Timer antikick{}; bool active = false; @@ -37,7 +25,7 @@ void user_message(bf_read &buffer, int type) { bool islocalplayer = false; - if (!enabled) + if (!enable) return; switch (type) { @@ -67,25 +55,6 @@ void user_message(bf_read &buffer, int type) playerlist::k_EState::FRIEND) { islocalplayer = true; - if (anti_votekick && !active) - { - active = true; - antikick.update(); - std::string msg(kick_msg.GetString()); - ReplaceString(msg, "$NAME", format(info.name)); - if (CE_GOOD(ENTITY(eid))) - { - int clz = g_pPlayerResource->GetClass(ENTITY(eid)); - ReplaceString(msg, "$CLASS", format(tf_classes[clz])); - } - NET_StringCmd senddata(format("say ", msg).c_str()); - INetChannel *ch = - (INetChannel *) g_IEngine->GetNetChannelInfo(); - senddata.SetNetChannel(ch); - senddata.SetReliable(true); - ch->SendNetMsg(senddata, true); - ch->Transmit(); - } } logging::Info("Vote called to kick %s [U:1:%u] for %s", name, steamID,