SurvivorBot::UseHealingItems
0x00940e60 · 2014 bytes · __cdecl
_ZN11SurvivorBot15UseHealingItemsEP6ActionIS_E
Decompiled
undefined (1 param)
/* SurvivorBot::UseHealingItems(Action<SurvivorBot>*) */
Action * SurvivorBot::UseHealingItems(Action *param_1)
{
float fVar1;
uint uVar2;
CTerrorPlayer *pCVar3;
int iVar4;
char cVar5;
SurvivorTeamSituation *this;
int iVar6;
undefined4 *puVar7;
SurvivorGivePillsToFriend *this_00;
CTerrorPlayer *pCVar8;
SurvivorHealFriend *this_01;
int *piVar9;
undefined *puVar10;
undefined4 uVar11;
longdouble lVar12;
longdouble lVar13;
float fVar14;
float fVar15;
SurvivorBot *in_stack_00000008;
int in_stack_0000000c;
byte local_39;
CTerrorPlayer *local_34;
float local_24;
undefined4 local_20 [4];
lVar12 = (longdouble)CountdownTimer::Now();
if ((float)lVar12 < *(float *)(in_stack_00000008 + 0x1ab90)) goto LAB_00940e8e;
lVar12 = (longdouble)CountdownTimer::Now();
fVar15 = *(float *)(in_stack_00000008 + 0x1ab8c);
if ((float)lVar12 + fVar15 != *(float *)(in_stack_00000008 + 0x1ab90)) {
(**(code **)(*(int *)(in_stack_00000008 + 0x1ab88) + 4))
(in_stack_00000008 + 0x1ab88,in_stack_00000008 + 0x1ab90);
*(float *)(in_stack_00000008 + 0x1ab90) = (float)lVar12 + fVar15;
}
cVar5 = IsAvailable(in_stack_00000008);
if ((cVar5 == '\0') || (0 < *(int *)(TheDirector + 0x460))) goto LAB_00940e8e;
this = (SurvivorTeamSituation *)GetTeamSituation(in_stack_00000008);
if ((*(int *)(TheDirector + 0x1c0) < 1) &&
(cVar5 = IsNearCheckpoint(in_stack_00000008), cVar5 == '\0')) {
local_39 = CTerrorPlayer::IsInCombat((CTerrorPlayer *)in_stack_00000008,false);
local_39 = local_39 ^ 1;
}
else {
local_39 = 0;
}
iVar6 = *(int *)(in_stack_00000008 + 0x100);
fVar15 = *(float *)(SurvivorBotTempHealthConsiderFactor._28_4_ + 0x2c);
lVar12 = (longdouble)(**(code **)(*(int *)in_stack_00000008 + 0x7e4))();
uVar2 = *(uint *)(this + 0x20);
fVar15 = (float)lVar12 * fVar15 + (float)iVar6;
local_34 = (CTerrorPlayer *)0x0;
if (((uVar2 != 0xffffffff) &&
(puVar10 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar10 + 8) == uVar2 >> 0xc)) {
local_34 = *(CTerrorPlayer **)(puVar10 + 4);
}
uVar11 = 0;
uVar2 = *(uint *)(this + 0x18);
if (((uVar2 != 0xffffffff) &&
(puVar10 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar10 + 8) == uVar2 >> 0xc)) {
uVar11 = *(undefined4 *)(puVar10 + 4);
}
cVar5 = (**(code **)(*(int *)(in_stack_00000008 + 0x4028) + 0xe0))
(in_stack_00000008 + 0x4028,uVar11);
pCVar8 = local_34;
if (((cVar5 == '\0') && (uVar2 = *(uint *)(this + 0x18), uVar2 != 0xffffffff)) &&
((puVar10 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc &&
(*(uint *)(puVar10 + 8) == uVar2 >> 0xc)))) {
pCVar3 = *(CTerrorPlayer **)(puVar10 + 4);
if (local_34 == (CTerrorPlayer *)0x0) {
pCVar8 = pCVar3;
if (pCVar3 == (CTerrorPlayer *)0x0) goto LAB_00941039;
}
else if ((pCVar3 != (CTerrorPlayer *)0x0) &&
(cVar5 = CTerrorPlayer::IsOnThirdStrike(local_34), cVar5 == '\0')) {
iVar6 = *(int *)(pCVar3 + 0x100);
fVar1 = *(float *)(SurvivorBotTempHealthConsiderFactor._28_4_ + 0x2c);
lVar12 = (longdouble)(**(code **)(*(int *)pCVar3 + 0x7e4))(pCVar3);
iVar4 = *(int *)(local_34 + 0x100);
fVar14 = *(float *)(SurvivorBotTempHealthConsiderFactor._28_4_ + 0x2c);
lVar13 = (longdouble)(**(code **)(*(int *)local_34 + 0x7e4))(local_34);
pCVar8 = pCVar3;
if ((float)lVar13 * fVar14 + (float)iVar4 <= (float)lVar12 * fVar1 + (float)iVar6) {
pCVar8 = local_34;
}
}
LAB_00941018:
local_34 = pCVar8;
cVar5 = CTerrorPlayer::IsInCombat(local_34,false);
if (((cVar5 == '\0') &&
(cVar5 = CBasePlayer::IsOnLadder((CBasePlayer *)local_34), cVar5 == '\0')) &&
(cVar5 = CTerrorPlayer::IsAdrenalineActive(local_34), cVar5 == '\0')) {
fVar1 = *(float *)(SurvivorBotToughnessBuffer._28_4_ + 0x2c);
iVar6 = *(int *)(local_34 + 0x100);
fVar14 = *(float *)(SurvivorBotTempHealthConsiderFactor._28_4_ + 0x2c);
lVar12 = (longdouble)(**(code **)(*(int *)local_34 + 0x7e4))(local_34);
fVar14 = (float)lVar12 * fVar14 + (float)iVar6;
if ((fVar14 < 50.0) && (fVar14 < fVar1 + fVar15)) {
if (30.0 <= fVar14) {
cVar5 = TryGivePillsToPatient(in_stack_00000008,local_34,1000.0);
if (cVar5 != '\0') {
this_00 = ::operator_new(0x68);
/* try { // try from 00941514 to 00941518 has its CatchHandler @ 0094165d */
SurvivorGivePillsToFriend::SurvivorGivePillsToFriend(this_00,local_34);
goto LAB_00941451;
}
}
else {
local_24 = 3.4028235e+38;
local_20[0] = 0xc;
if ((((local_39 != 0) &&
(pCVar8 = CDirectorTacticalServices::
GetSurvivorAbleToReachEntityFirst<SurvivorHasItemFilter>
(*(CDirectorTacticalServices **)(TheDirector + 0x628),
(CBaseEntity *)local_34,(SurvivorHasItemFilter *)local_20,
&local_24), pCVar8 != (CTerrorPlayer *)0x0)) &&
((cVar5 = (**(code **)(*(int *)(in_stack_00000008 + 0x4028) + 0xe0))
(in_stack_00000008 + 0x4028,pCVar8), cVar5 != '\0' &&
(local_24 < 1000.0)))) &&
(((cVar5 = (**(code **)(*(int *)local_34 + 0x778))(local_34), cVar5 != '\0' ||
(piVar9 = (int *)CTerrorPlayer::GetActiveTerrorWeapon(local_34), piVar9 == (int *)0x0
)) || (iVar6 = (**(code **)(*piVar9 + 0x638))(piVar9), iVar6 != 0xc)))) {
this_01 = ::operator_new(0x40);
/* try { // try from 009415ac to 009415b0 has its CatchHandler @ 0094164b */
SurvivorHealFriend::SurvivorHealFriend(this_01,local_34);
*(undefined4 *)param_1 = 2;
*(SurvivorHealFriend **)(param_1 + 4) = this_01;
*(char **)(param_1 + 8) = "Trying to heal a friend";
*(undefined4 *)(in_stack_0000000c + 0x20) = 0;
*(undefined4 *)(in_stack_0000000c + 0x24) = 0;
*(undefined4 *)(in_stack_0000000c + 0x28) = 0;
*(undefined4 *)(in_stack_0000000c + 0x2c) = 0;
return param_1;
}
cVar5 = TryGivePillsToPatient(in_stack_00000008,local_34,1000.0);
if (cVar5 != '\0') {
this_00 = ::operator_new(0x68);
/* try { // try from 0094144c to 00941450 has its CatchHandler @ 0094165f */
SurvivorGivePillsToFriend::SurvivorGivePillsToFriend(this_00,local_34);
LAB_00941451:
*(undefined4 *)param_1 = 2;
*(SurvivorGivePillsToFriend **)(param_1 + 4) = this_00;
*(char **)(param_1 + 8) = "Giving pills to a friend";
*(undefined4 *)(in_stack_0000000c + 0x20) = 0;
*(undefined4 *)(in_stack_0000000c + 0x24) = 0;
*(undefined4 *)(in_stack_0000000c + 0x28) = 0;
*(undefined4 *)(in_stack_0000000c + 0x2c) = 0;
return param_1;
}
}
}
}
}
else if (local_34 != (CTerrorPlayer *)0x0) goto LAB_00941018;
LAB_00941039:
uVar2 = *(uint *)(this + 0x28);
if ((((uVar2 != 0xffffffff) &&
(puVar10 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
((*(uint *)(puVar10 + 8) == uVar2 >> 0xc &&
((*(CTerrorPlayer **)(puVar10 + 4) != (CTerrorPlayer *)0x0 &&
(lVar12 = (longdouble)
SurvivorTeamSituation::GetDistanceToFriend(this,*(CTerrorPlayer **)(puVar10 + 4)),
400.0 < (float)lVar12)))))) ||
((30.0 <= fVar15 || ((local_39 == 0 || (iVar6 = CTerrorPlayer::GetTerrorWeapon(), iVar6 == 0)))
))) {
iVar6 = *(int *)(in_stack_00000008 + 0x100);
lVar12 = (longdouble)(**(code **)(*(int *)in_stack_00000008 + 0x7e4))();
if (((50.0 <= (float)lVar12 + (float)iVar6) ||
((iVar6 = (**(code **)(*(int *)in_stack_00000008 + 0x52c))(), iVar6 != 0 &&
((*(byte *)(iVar6 + 0x12d) & 8) != 0)))) ||
((iVar6 = CTerrorPlayer::GetTerrorWeapon(), iVar6 == 0 &&
((iVar6 = CTerrorPlayer::GetTerrorWeapon(), iVar6 == 0 ||
(lVar12 = (longdouble)
CTerrorPlayer::GetTimeSinceAttackedByEnemy((CTerrorPlayer *)in_stack_00000008),
(float)lVar12 <= 2.0)))))) {
LAB_00940e8e:
*(undefined4 *)param_1 = 0;
*(undefined4 *)(param_1 + 4) = 0;
*(undefined4 *)(param_1 + 8) = 0;
return param_1;
}
puVar7 = ::operator_new(0x40);
puVar7[8] = 0;
puVar7[9] = 0;
puVar7[10] = 0;
puVar7[3] = 0;
puVar7[4] = 0;
puVar7[5] = 0;
puVar7[6] = 0;
puVar7[7] = 0;
puVar7[2] = 0;
*(undefined1 *)(puVar7 + 0xc) = 0;
*(undefined1 *)((int)puVar7 + 0x31) = 0;
puVar7[0xb] = 0;
*puVar7 = &PTR__SurvivorTakePills_00d06dc8;
puVar7[1] = &PTR__SurvivorTakePills_00d06f2c;
}
else {
puVar7 = ::operator_new(0x40);
puVar7[8] = 0;
puVar7[9] = 0;
puVar7[10] = 0;
puVar7[3] = 0;
puVar7[4] = 0;
puVar7[5] = 0;
puVar7[6] = 0;
puVar7[7] = 0;
puVar7[2] = 0;
*(undefined1 *)(puVar7 + 0xc) = 0;
*(undefined1 *)((int)puVar7 + 0x31) = 0;
puVar7[0xb] = 0;
*puVar7 = &PTR__SurvivorHealSelf_00d06c28;
puVar7[1] = &PTR__SurvivorHealSelf_00d06d8c;
}
puVar7[0xd] = &PTR_NetworkStateChanged_00c0b6e0;
puVar7[0xe] = 0;
puVar7[0xf] = 0xbf800000;
*(undefined4 *)param_1 = 2;
*(undefined4 **)(param_1 + 4) = puVar7;
*(undefined4 *)(param_1 + 8) = 0;
*(undefined4 *)(in_stack_0000000c + 0x20) = 0;
*(undefined4 *)(in_stack_0000000c + 0x24) = 0;
*(undefined4 *)(in_stack_0000000c + 0x28) = 0;
*(undefined4 *)(in_stack_0000000c + 0x2c) = 0;
return param_1;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.