heal arrows callout, close #175
This commit is contained in:
parent
a1fde3f4de
commit
82089d5285
@ -270,6 +270,7 @@ void hack::Initialize() {
|
|||||||
logging::Info("SDL hooking done");
|
logging::Info("SDL hooking done");
|
||||||
g_IGameEventManager->AddListener(&adv_event_listener, false);
|
g_IGameEventManager->AddListener(&adv_event_listener, false);
|
||||||
hacks::shared::anticheat::Init();
|
hacks::shared::anticheat::Init();
|
||||||
|
hacks::tf2::healarrow::Init();
|
||||||
InitSpinner();
|
InitSpinner();
|
||||||
logging::Info("Initialized Fidget Spinner");
|
logging::Info("Initialized Fidget Spinner");
|
||||||
|
|
||||||
|
@ -10,11 +10,53 @@
|
|||||||
namespace hacks { namespace tf2 { namespace healarrow {
|
namespace hacks { namespace tf2 { namespace healarrow {
|
||||||
|
|
||||||
static CatVar healarrow_charge(CV_FLOAT, "healarrow_charge", "0.25", "Healarrow Charge");
|
static CatVar healarrow_charge(CV_FLOAT, "healarrow_charge", "0.25", "Healarrow Charge");
|
||||||
static CatVar healarrow_timeout(CV_FLOAT, "healarrow_timeout", "12.5", "Healarrow Timeout");
|
static CatVar healarrow_timeout(CV_FLOAT, "healarrow_timeout", "2", "Healarrow Timeout");
|
||||||
static CatVar healarrow(CV_SWITCH, "healarrow", "0", "Heal Arrow");
|
static CatVar healarrow(CV_SWITCH, "healarrow", "0", "Heal Arrow");
|
||||||
|
static CatVar healarrow_callout(CV_SWITCH, "healarrow_callout", "0", "Call Out", "Send a message to chat when you heal someone with an arrow");
|
||||||
|
static CatVar healarrow_callout_message(CV_STRING, "healarrow_callout_text", "Hey %%, I've just healed you for $$ HP! Your health is now ##.", "Call Out Text", "Formatting:\n%% - player name\n$$ - healing amount\n## - new health\n@@ - old health");
|
||||||
|
|
||||||
float healarrow_time = 0.0f;
|
float healarrow_time = 0.0f;
|
||||||
|
|
||||||
|
class HealArrowListener : public IGameEventListener {
|
||||||
|
public:
|
||||||
|
virtual void FireGameEvent(KeyValues* event) {
|
||||||
|
if (!healarrow) return;
|
||||||
|
if (!healarrow_callout) return;
|
||||||
|
if (CE_BAD(LOCAL_W)) return;
|
||||||
|
if (LOCAL_W->m_iClassID != CL_CLASS(CTFCompoundBow)) return;
|
||||||
|
std::string name(event->GetName());
|
||||||
|
if (name == "player_hurt") {
|
||||||
|
int attacker = event->GetInt("attacker");
|
||||||
|
int victim = event->GetInt("userid");
|
||||||
|
int eid = g_IEngine->GetPlayerForUserID(attacker);
|
||||||
|
int vid = g_IEngine->GetPlayerForUserID(victim);
|
||||||
|
if (eid == g_IEngine->GetLocalPlayer()) {
|
||||||
|
int damageamount = event->GetInt("damageamount");
|
||||||
|
if (damageamount < 0) {
|
||||||
|
player_info_s pinfo;
|
||||||
|
if (g_IEngine->GetPlayerInfo(vid, &pinfo)) {
|
||||||
|
std::string msg(healarrow_callout_message.GetString());
|
||||||
|
ReplaceString(msg, "$$", std::to_string(-damageamount));
|
||||||
|
auto v_entity = ENTITY(vid);
|
||||||
|
if (CE_GOOD(v_entity)) {
|
||||||
|
ReplaceString(msg, "##", std::to_string(CE_INT(v_entity, netvar.iHealth) - damageamount));
|
||||||
|
ReplaceString(msg, "@@", std::to_string(CE_INT(v_entity, netvar.iHealth)));
|
||||||
|
}
|
||||||
|
ReplaceString(msg, "%%", pinfo.name);
|
||||||
|
chat_stack::Say(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
HealArrowListener listener;
|
||||||
|
|
||||||
|
void Init() {
|
||||||
|
g_IGameEventManager->AddListener(&listener, false);
|
||||||
|
}
|
||||||
|
|
||||||
void CreateMove() {
|
void CreateMove() {
|
||||||
if (CE_BAD(LOCAL_W)) return;
|
if (CE_BAD(LOCAL_W)) return;
|
||||||
if (healarrow) {
|
if (healarrow) {
|
||||||
|
@ -11,5 +11,6 @@ namespace hacks { namespace tf2 { namespace healarrow {
|
|||||||
|
|
||||||
void CreateMove();
|
void CreateMove();
|
||||||
void Draw();
|
void Draw();
|
||||||
|
void Init();
|
||||||
|
|
||||||
}}}
|
}}}
|
||||||
|
@ -449,7 +449,9 @@
|
|||||||
"list": [
|
"list": [
|
||||||
"healarrow",
|
"healarrow",
|
||||||
"healarrow_charge",
|
"healarrow_charge",
|
||||||
"healarrow_timeout"
|
"healarrow_timeout",
|
||||||
|
"healarrow_callout",
|
||||||
|
"healarrow_callout_text"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
echo "Searching for Team Fortress 2"
|
echo "Searching for Team Fortress 2"
|
||||||
|
echo "Please wait..."
|
||||||
|
|
||||||
find / -type d -name "Team Fortress 2" 2>/dev/null | while read path; do
|
find / -type d -name "Team Fortress 2" 2>/dev/null | while read path; do
|
||||||
if [ -e "$path/tf/gameinfo.txt" ]; then
|
if [ -e "$path/tf/gameinfo.txt" ]; then
|
||||||
@ -10,6 +11,7 @@ find / -type d -name "Team Fortress 2" 2>/dev/null | while read path; do
|
|||||||
ln -s "$path/cathook" "Data Folder"
|
ln -s "$path/cathook" "Data Folder"
|
||||||
rsync -avh --progress tf-settings/ "$path/cathook"
|
rsync -avh --progress tf-settings/ "$path/cathook"
|
||||||
echo "Symbolic link created (Data Folder)"
|
echo "Symbolic link created (Data Folder)"
|
||||||
|
echo "You can close this window"
|
||||||
read -p "Press ENTER to continue"
|
read -p "Press ENTER to continue"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user