L L4D2node

CL4DGameStats::Event_ActorKilled

0x008e0e00 · 1643 bytes · __thiscall

_ZN13CL4DGameStats17Event_ActorKilledEP20CBaseCombatCharacterRK15CTakeDamageInfo

Decompiled

undefined (3 params)

/* CL4DGameStats::Event_ActorKilled(CBaseCombatCharacter*, CTakeDamageInfo const&) */

void __thiscall
CL4DGameStats::Event_ActorKilled
          (CL4DGameStats *this,CBaseCombatCharacter *param_1,CTakeDamageInfo *param_2)

{
  char cVar1;
  CTerrorPlayer *this_00;
  int iVar2;
  undefined4 uVar3;
  int *piVar4;
  char *pcVar5;
  undefined *puVar6;
  uint uVar7;
  CBaseEntity *this_01;
  uint uVar8;
  bool bVar9;
  CBaseEntity *pCVar10;
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 local_48;
  uint local_44;
  CBaseEntity *local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  uint local_30;
  uint local_2c;
  undefined4 local_28;
  uint local_24;
  undefined4 local_20;
  
  if ((param_1 == (CBaseCombatCharacter *)0x0) ||
     (cVar1 = (**(code **)(*(int *)param_1 + 0x16c))(param_1), this_01 = (CBaseEntity *)param_1,
     cVar1 == '\0')) {
    this_01 = (CBaseEntity *)0x0;
  }
  local_44 = 0;
  uVar8 = *(uint *)(param_2 + 0x30);
  if (((uVar8 != 0xffffffff) &&
      (puVar6 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar6 + 8) == uVar8 >> 0xc)) {
    local_44 = *(uint *)(puVar6 + 4);
  }
  local_40 = (CBaseEntity *)0x0;
  uVar8 = *(uint *)(param_2 + 0x34);
  if (((uVar8 != 0xffffffff) &&
      (puVar6 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar6 + 8) == uVar8 >> 0xc)) {
    local_40 = *(CBaseEntity **)(puVar6 + 4);
  }
  pCVar10 = local_40;
  this_00 = (CTerrorPlayer *)CTerrorGameRules::GetDeathScorer(g_pGameRules,local_40);
  if ((this_00 == (CTerrorPlayer *)0x0) ||
     (cVar1 = (**(code **)(*(int *)this_00 + 0x16c))(this_00,pCVar10,local_44), cVar1 == '\0')) {
    this_00 = (CTerrorPlayer *)0x0;
    local_44 = *(uint *)(param_2 + 0x48);
    if (this_01 != (CBaseEntity *)0x0) goto LAB_008e0ed8;
LAB_008e0fc3:
    if ((param_1 == (CBaseCombatCharacter *)0x0) ||
       (iVar2 = (**(code **)(*(int *)param_1 + 0x14c))(param_1), iVar2 == 0)) {
      bVar9 = true;
      local_50 = 0;
      local_4c = 0;
      uVar8 = 0;
      local_48 = 0;
    }
    else {
      piVar4 = (int *)(**(code **)(*(int *)param_1 + 0x14c))(param_1);
      iVar2 = (**(code **)(*piVar4 + 0x544))(piVar4);
      if (iVar2 == 0) {
        IncrementStatForSurvivor(this,this_00,0x1c,1);
      }
      else {
        piVar4 = (int *)(**(code **)(*(int *)param_1 + 0x14c))(param_1);
        iVar2 = (**(code **)(*piVar4 + 0x544))(piVar4);
        if (iVar2 == 7) {
          IncrementStatForSurvivor(this,this_00,0x23,1);
        }
      }
      if (((byte)param_1[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
      }
      local_48 = *(undefined4 *)(param_1 + 0x2e0);
      local_4c = *(undefined4 *)(param_1 + 0x2e4);
      local_50 = *(undefined4 *)(param_1 + 0x2e8);
      piVar4 = (int *)(**(code **)(*(int *)param_1 + 0x14c))(param_1);
      uVar8 = (**(code **)(*piVar4 + 0x544))(piVar4);
      bVar9 = uVar8 != 0;
      uVar8 = uVar8 | 0x40000000;
    }
  }
  else {
    local_44 = *(uint *)(param_2 + 0x48);
    if (this_01 == (CBaseEntity *)0x0) goto LAB_008e0fc3;
LAB_008e0ed8:
    iVar2 = CBaseEntity::GetTeamNumber(this_01);
    if (iVar2 == 3) {
      uVar8 = (**(code **)(*(int *)this_01 + 0x544))(this_01);
      uVar8 = uVar8 | 0x40000000;
    }
    else {
      uVar8 = 0;
      iVar2 = CBaseEntity::GetTeamNumber(this_01);
      if (iVar2 == 2) {
        uVar8 = *(uint *)(this_01 + 0x2ba0);
      }
    }
    local_48 = *(undefined4 *)(this_01 + 0x2d3c);
    local_4c = *(undefined4 *)(this_01 + 0x2d40);
    local_50 = *(undefined4 *)(this_01 + 0x2d44);
    iVar2 = CBaseEntity::GetTeamNumber(this_01);
    if (iVar2 == 3) {
      uVar3 = (**(code **)(*(int *)this_01 + 0x544))(this_01);
      switch(uVar3) {
      default:
        bVar9 = true;
        goto LAB_008e0f4a;
      case 1:
        iVar2 = 0x1d;
        break;
      case 2:
        iVar2 = 0x1e;
        break;
      case 3:
        iVar2 = 0x1f;
        break;
      case 4:
        iVar2 = 0x20;
        break;
      case 5:
        iVar2 = 0x21;
        break;
      case 6:
        iVar2 = 0x22;
        break;
      case 8:
        iVar2 = 0x24;
      }
      bVar9 = true;
      IncrementStatForSurvivor(this,this_00,iVar2,1);
    }
    else {
      bVar9 = true;
      iVar2 = CBaseEntity::GetTeamNumber(this_01);
      if ((iVar2 == 2) && (iVar2 = GetAliveSurvivorCount(), iVar2 == 2)) {
        *(int *)(this + 0x3c0) = *(int *)(this + 0x3c0) + 1;
      }
    }
  }
LAB_008e0f4a:
  if (this_00 == (CTerrorPlayer *)0x0) {
    if ((local_40 == (CBaseEntity *)0x0) ||
       (iVar2 = (**(code **)(*(int *)local_40 + 0x14c))(local_40), iVar2 == 0)) {
      uVar7 = 0x3fffffff;
    }
    else {
      piVar4 = (int *)(**(code **)(*(int *)local_40 + 0x14c))(local_40);
      uVar7 = (**(code **)(*piVar4 + 0x544))(piVar4);
      uVar7 = uVar7 | 0x40000000;
    }
  }
  else {
    iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this_00);
    if (iVar2 == 3) {
      uVar7 = (**(code **)(*(int *)this_00 + 0x544))(this_00);
      uVar7 = uVar7 | 0x40000000;
    }
    else {
      iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this_00);
      uVar7 = 0;
      if (iVar2 == 2) {
        uVar7 = *(uint *)(this_00 + 0x2ba0);
      }
    }
  }
  if (bVar9) {
    local_20 = CSteamWorksGameStatsUploader::GetTimeSinceEpoch();
    local_3c = local_48;
    local_38 = local_4c;
    local_28 = 0;
    local_34 = local_50;
    local_24 = local_44;
    local_30 = uVar8;
    local_2c = uVar7;
    CUtlVector<L4D_Death_Position_Data,CUtlMemory<L4D_Death_Position_Data,int>>::InsertBefore
              ((CUtlVector<L4D_Death_Position_Data,CUtlMemory<L4D_Death_Position_Data,int>> *)
               (this + 0x49c),*(int *)(this + 0x4a8),(L4D_Death_Position_Data *)&local_3c);
  }
  if (0x3fffffff < (int)uVar8) {
    *(int *)(this + 0x3a8) = *(int *)(this + 0x3a8) + 1;
  }
  if (this_00 == (CTerrorPlayer *)0x0) {
    return;
  }
  iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this_00);
  if (iVar2 != 2) {
    return;
  }
  IncrementStatForSurvivor(this,this_00,0x15,1);
  if ((local_44 & 0x8000040) == 0x8000040) {
    iVar2 = 0x15;
  }
  else {
    if ((local_44 & 0x1000040) != 0x1000040) {
      if ((local_44 & 2) == 0) {
        if ((local_44 & 8) != 0) {
          iVar2 = 0x14;
          goto LAB_008e1303;
        }
      }
      else if ((local_44 & 8) == 0) {
        if ((local_44 & 0x40) != 0) {
          IncrementWeaponStat(this,this_00,0x26,4,1);
        }
      }
      else {
        IncrementWeaponStat(this,this_00,0x25,4,1);
      }
      piVar4 = (int *)CTerrorPlayer::GetActiveTerrorWeapon(this_00);
      if (piVar4 != (int *)0x0) {
        pcVar5 = (char *)(**(code **)(*piVar4 + 0x538))(piVar4);
        if ((pcVar5 == "weapon_melee") || (iVar2 = _V_stricmp(pcVar5,"weapon_melee"), iVar2 == 0)) {
          IncrementStatForSurvivor(this,this_00,0x27,1);
        }
        iVar2 = WeaponNameToIDForStats(this_00,pcVar5);
        if (iVar2 != -1) goto LAB_008e1303;
      }
      return;
    }
    iVar2 = 0x11;
  }
LAB_008e1303:
  IncrementWeaponStat(this,this_00,iVar2,4,1);
  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)