Skip to content
Permalink
Browse files

Noisemaker changes

* Add Auto Noisemaker Equip (in Catbot Tab)
* Add Noisemaker spam to Catbot Tab
  • Loading branch information
BenCat07 committed Dec 22, 2019
1 parent af0ad64 commit a7e8c9eb35f99c443b6cf1502c536e0d50e0ff8c
Showing with 33 additions and 0 deletions.
  1. +2 −0 data/menu/nullifiedcat/misc/catbot.xml
  2. +31 −0 src/hacks/Achievement.cpp
@@ -56,6 +56,8 @@
<AutoVariable width="fill" target="misc.autodisguise" label="Autodisguise"/>
<AutoVariable width="fill" target="cat-bot.anti-motd" label="Anti MOTD"/>
<AutoVariable width="fill" target="cat-bot.autovote-map" label="Autovote for current map"/>
<AutoVariable width="fill" target="noisemaker-spam.enable" label="Noisemaker Spam"/>
<AutoVariable width="fill" target="misc.auto-noisemaker" label="Auto Equip and Unlock Noisemakers"/>
</List>
</Box>
</Tab>
@@ -35,6 +35,7 @@ static settings::Int equip_secondary{ "achievement.equip-secondary", "0" };
static settings::Int equip_melee{ "achievement.equip-melee", "0" };
static settings::Int equip_pda2{ "achievement.equip-pda2", "0" };
static settings::Boolean hat_troll{ "misc.nohatsforyou", "false" };
static settings::Boolean auto_noisemaker{ "misc.auto-noisemaker", "false" };

bool checkachmngr()
{
@@ -182,6 +183,7 @@ static CatCommand get_sniper_items("achievement_sniper", "Get all sniper achieve
});

static Timer accept_time{};
static Timer equip_noisemaker{};
static Timer cooldowm{};
static Timer cooldown_2{};
static CatCommand get_best_hats("achievement_cathats", "Get and equip the bencat hats", []() {
@@ -212,6 +214,13 @@ bool equip_item(int clazz, int slot, int id)
}
return false;
}
bool equip_action_item(int action_item, std::pair<int, int> classes)
{
for (int i = classes.first; i <= classes.second; i++)
if (!equip_item(i, 9, action_item))
return false;
return true;
}

bool equip_hats_fn(std::vector<int> hats, std::pair<int, int> classes)
{
@@ -310,6 +319,28 @@ void Paint()
if (!accept_time.check(5000) && cooldowm.test_and_set(500))
g_IEngine->ClientCmd_Unrestricted("cl_trigger_first_notification");

// Noisemaker code
if (auto_noisemaker && equip_noisemaker.test_and_set(60000))
{
// Inventory Manager
auto invmng = re::CTFInventoryManager::GTFInventoryManager();
// Inventory
auto inv = invmng->GTFPlayerInventory();

// No Noisemaker in inventory?
if (!inv->GetFirstItemOfItemDef(673) && !inv->GetFirstItemOfItemDef(536))
accept_time.update();
else
{
bool success = equip_action_item(673, { tf_scout, tf_engineer });
if (!success)
{
success = equip_action_item(536, { tf_scout, tf_engineer });
if (!success)
logging::Info("Bruh moment while equipping noisemaker");
}
}
}
// Hat equip code
if (equip_hats)
{

0 comments on commit a7e8c9e

Please sign in to comment.
You can’t perform that action at this time.