L L4D2node

CFirstAidKit::OnActionComplete

0x00537140 · 653 bytes · __thiscall

_ZN12CFirstAidKit16OnActionCompleteEP13CTerrorPlayerP11CBaseEntity

Decompiled

undefined (3 params)

/* CFirstAidKit::OnActionComplete(CTerrorPlayer*, CBaseEntity*) */

void __thiscall
CFirstAidKit::OnActionComplete(CFirstAidKit *this,CTerrorPlayer *param_1,CBaseEntity *param_2)

{
  code *pcVar1;
  int iVar2;
  CBaseEdict *this_00;
  char cVar3;
  int *piVar4;
  undefined4 uVar5;
  int iVar6;
  char *pcVar7;
  undefined4 *puVar8;
  float fVar9;
  float fVar10;
  CAI_Concept local_4c [8];
  undefined4 local_44;
  undefined4 local_40;
  CAI_Concept local_3c [44];
  
  if (param_2 != (CBaseEntity *)0x0) {
    cVar3 = (**(code **)(*(int *)param_2 + 0x16c))(param_2);
    if (cVar3 != '\0') goto LAB_0053716a;
  }
  param_2 = (CBaseEntity *)0x0;
LAB_0053716a:
  fVar9 = *(float *)(FirstAidKitMaxHeal._28_4_ + 0x2c) - (float)*(int *)(param_2 + 0x100);
  fVar10 = 0.0;
  if (0.0 < fVar9) {
    fVar10 = fVar9 * *(float *)(FirstAidKitHealPercent._28_4_ + 0x2c);
  }
  (**(code **)(*(int *)param_2 + 0x128))(param_2,fVar10,0);
  CTerrorPlayer::SetHealthBuffer((CTerrorPlayer *)param_2,0.0);
  piVar4 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"heal_success",0,0);
  if (piVar4 != (int *)0x0) {
    pcVar1 = *(code **)(*piVar4 + 0x30);
    uVar5 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(param_1 + 0x30));
    (*pcVar1)(piVar4,"userid",uVar5);
    pcVar1 = *(code **)(*piVar4 + 0x30);
    uVar5 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(param_2 + 0x30));
    (*pcVar1)(piVar4,"subject",uVar5);
    (**(code **)(*piVar4 + 0x30))(piVar4,"health_restored",(int)fVar10);
    (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar4,0);
  }
  iVar2 = *(int *)(param_1 + 0x3900);
  if (param_1[0x6c] == (CTerrorPlayer)0x0) {
    this_00 = *(CBaseEdict **)(param_1 + 0x30);
    if (this_00 != (CBaseEdict *)0x0) {
      *(uint *)this_00 = *(uint *)this_00 | 0x101;
      iVar6 = CBaseEdict::GetChangeAccessor(this_00);
      *(undefined2 *)(iVar6 + 2) = 0;
    }
  }
  else {
    param_1[0x70] = (CTerrorPlayer)((byte)param_1[0x70] | 1);
  }
  *(int *)(param_1 + 0x3900) = iVar2 + 1;
  pcVar1 = *(code **)(*(int *)param_2 + 0x7b4);
  CAI_Concept::CAI_Concept(local_3c,"RelaxedSigh");
  (*pcVar1)(param_2,local_3c,1,0,0,0,0);
  if (param_1 != (CTerrorPlayer *)param_2) {
    AI_CriteriaSet::AI_CriteriaSet((AI_CriteriaSet *)local_3c);
                    /* try { // try from 00537327 to 005373ac has its CatchHandler @ 005373d9 */
    pcVar7 = (char *)SurvivorCharacterName(*(undefined4 *)(param_1 + 0x2ba0));
    AI_CriteriaSet::AppendCriteria((AI_CriteriaSet *)local_3c,"Subject",pcVar7,1.0);
    puVar8 = (undefined4 *)(**(code **)(*(int *)param_2 + 0xc))(param_2);
    uVar5 = *puVar8;
    CAI_Concept::CAI_Concept(local_4c,"HealedByFriend");
    local_44 = 2;
    local_40 = uVar5;
    CResponseQueue::Add((CResponseQueue *)g_ResponseQueueManager._12_4_,local_4c,
                        (AI_CriteriaSet *)local_3c,*(float *)(gpGlobals + 0xc) + 1.0,
                        (CFollowupTargetSpec_t *)&local_44,(CBaseEntity *)param_1);
    AI_CriteriaSet::~AI_CriteriaSet((AI_CriteriaSet *)local_3c);
  }
  return;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)