L L4D2node

CPainPills::CompleteUse

0x005529d0 · 792 bytes · __thiscall

_ZN10CPainPills11CompleteUseEP13CTerrorPlayer

Decompiled

undefined (2 params)

/* CPainPills::CompleteUse(CTerrorPlayer*) */

void __thiscall CPainPills::CompleteUse(CPainPills *this,CTerrorPlayer *param_1)

{
  CBaseEdict *pCVar1;
  char cVar2;
  CTerrorPlayer CVar3;
  char cVar4;
  int iVar5;
  int iVar6;
  CEventLog *this_00;
  undefined4 uVar7;
  int *piVar8;
  undefined4 uVar9;
  int in_GS_OFFSET;
  longdouble lVar10;
  longdouble lVar11;
  CFmtStrN<256> local_12c [5];
  undefined1 local_127 [263];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  uVar9 = *(undefined4 *)(param_1 + 0x100);
  lVar10 = (longdouble)(**(code **)(*(int *)param_1 + 0x7e4))(param_1);
  iVar5 = (**(code **)(*(int *)param_1 + 0x1fc))(param_1);
  CTerrorPlayer::AddHealthBuffer
            (param_1,*(float *)(PainPillsHealthValue._28_4_ + 0x2c),(float)iVar5);
  cVar2 = CDirectorChallengeMode::TempHealthOnly(*(CDirectorChallengeMode **)(TheDirector + 0x648));
  if (cVar2 != '\0') {
    cVar4 = '\0';
    iVar5 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_1);
    cVar2 = IsASurvivorTeam(iVar5);
    if (cVar2 != '\0') {
      cVar4 = CTerrorPlayer::IsOnThirdStrike(param_1);
    }
    if (*(int *)(param_1 + 0x2e54) != 0) {
      if (param_1[0x6c] == (CTerrorPlayer)0x0) {
        pCVar1 = *(CBaseEdict **)(param_1 + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar5 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar5 + 2) = 0;
        }
      }
      else {
        param_1[0x70] = (CTerrorPlayer)((byte)param_1[0x70] | 1);
      }
      *(undefined4 *)(param_1 + 0x2e54) = 0;
    }
    CVar3 = (CTerrorPlayer)CTerrorPlayer::IsOnThirdStrike(param_1);
    if (CVar3 != param_1[0x2e58]) {
      if (param_1[0x6c] == (CTerrorPlayer)0x0) {
        pCVar1 = *(CBaseEdict **)(param_1 + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar5 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar5 + 2) = 0;
        }
      }
      else {
        param_1[0x70] = (CTerrorPlayer)((byte)param_1[0x70] | 1);
      }
      param_1[0x2e58] = CVar3;
    }
    cVar2 = CTerrorPlayer::IsOnThirdStrike(param_1);
    if (cVar2 == '\0') {
      if (cVar4 != '\0') {
        CTerrorPlayer::StopTrackedSound(param_1,"Player.Heartbeat");
      }
    }
    else {
      CTerrorPlayer::StopTrackedSound(param_1,"Player.Heartbeat");
      CCSPlayer::EmitPrivateSound((CCSPlayer *)param_1,"Player.Heartbeat");
      CTerrorPlayer::TrackSound(param_1,"Player.Heartbeat");
    }
  }
  iVar5 = *(int *)(param_1 + 0x3904);
  if (param_1[0x6c] == (CTerrorPlayer)0x0) {
    pCVar1 = *(CBaseEdict **)(param_1 + 0x30);
    if (pCVar1 != (CBaseEdict *)0x0) {
      *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
      iVar6 = CBaseEdict::GetChangeAccessor(pCVar1);
      *(undefined2 *)(iVar6 + 2) = 0;
    }
  }
  else {
    param_1[0x70] = (CTerrorPlayer)((byte)param_1[0x70] | 1);
  }
  *(int *)(param_1 + 0x3904) = iVar5 + 1;
  this_00 = (CEventLog *)TheLog();
  uVar7 = CEventLog::FormatPlayer(this_00,(CBaseEntity *)param_1);
  lVar11 = (longdouble)(**(code **)(*(int *)param_1 + 0x7e4))(param_1);
  CFmtStrN<256>::CFmtStrN
            (local_12c,
             "%s used pills on %s starting with %d health and %.1f pill health, and ended with %d health and %.1f pill health\n"
             ,uVar7,uVar7,uVar9,(double)(float)lVar10,*(undefined4 *)(param_1 + 0x100),
             (double)(float)lVar11);
  UTIL_LogPrintf("%s",local_127);
  DevMsg(2,"%s",local_127);
  piVar8 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"pills_used",0,0);
  if (piVar8 != (int *)0x0) {
    uVar9 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(param_1 + 0x30));
    (**(code **)(*piVar8 + 0x30))(piVar8,"userid",uVar9);
    (**(code **)(*piVar8 + 0x30))(piVar8,"subject",uVar9);
    (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar8,0);
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)