L L4D2node

CTerrorEventLog::PrintTerrorEvent

0x0096f130 · 2502 bytes · __thiscall

_ZN15CTerrorEventLog16PrintTerrorEventEP10IGameEvent

Decompiled

undefined (2 params)

/* CTerrorEventLog::PrintTerrorEvent(IGameEvent*) */

undefined4 __thiscall CTerrorEventLog::PrintTerrorEvent(CTerrorEventLog *this,IGameEvent *param_1)

{
  char cVar1;
  byte bVar2;
  char *pcVar3;
  int iVar4;
  int iVar5;
  int *piVar6;
  int *piVar7;
  undefined4 uVar8;
  undefined4 uVar9;
  CBasePlayer *pCVar10;
  uint uVar11;
  undefined4 uVar12;
  undefined4 uVar13;
  undefined4 uVar14;
  CBasePlayer *pCVar15;
  CBaseEntity *pCVar16;
  int in_GS_OFFSET;
  int *piVar17;
  char *local_234;
  CBaseEntity *local_230;
  undefined1 local_220 [256];
  undefined1 local_120 [256];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  pcVar3 = (char *)(**(code **)(*(int *)param_1 + 8))(param_1);
  iVar4 = _V_strlen("round_end");
  iVar4 = V_strncmp(pcVar3,"round_end",iVar4);
  if (iVar4 != 0) {
    iVar4 = V_strncmp(pcVar3,"server_",7);
    if (iVar4 != 0) {
      if ((pcVar3 == "player_hurt") || (iVar4 = _V_stricmp(pcVar3,"player_hurt"), iVar4 == 0)) {
        iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
        pCVar16 = (CBaseEntity *)UTIL_PlayerByUserId(iVar4);
        if (pCVar16 != (CBaseEntity *)0x0) {
          uVar8 = (**(code **)(*(int *)param_1 + 0x28))(param_1,"weapon",&DAT_00d539c2);
          iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"attacker",0);
          if (iVar4 == 0) {
            iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"attackerentid");
            local_230 = (CBaseEntity *)UTIL_EntityByIndex(iVar4);
          }
          else {
            iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"attacker",0);
            local_230 = (CBaseEntity *)UTIL_PlayerByUserId(iVar4);
          }
          if (local_230 != (CBaseEntity *)0x0) {
            iVar4 = CBaseEntity::GetTeamNumber(pCVar16);
            iVar5 = CBaseEntity::GetTeamNumber(local_230);
            if ((iVar4 == iVar5) && (local_230 != pCVar16)) {
              bVar2 = *(byte *)(mp_logdetail._28_4_ + 0x30) & 2;
            }
            else {
              bVar2 = *(byte *)(mp_logdetail._28_4_ + 0x30) & 1;
            }
            if (bVar2 != 0) {
              uVar11 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"hitgroup",0);
              local_234 = "GENERIC";
              if (uVar11 < 8) {
                local_234 = *(char **)(CSWTCH_1174 + uVar11 * 4);
              }
              (**(code **)(*(int *)this + 0x14))(this,local_230,local_220,0x100);
              (**(code **)(*(int *)this + 0x14))(this,pCVar16,local_120,0x100);
              uVar9 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"armor",0);
              uVar14 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"health",0);
              uVar12 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"dmg_armor",0);
              uVar13 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"dmg_health",0);
              UTIL_LogPrintf("(DAMAGE)%s attacked %s with \"%s\" (damage \"%d\") (damage_armor \"%d\") (health \"%d\") (armor \"%d\") (hitgroup \"%s\")\n"
                             ,local_220,local_120,uVar8,uVar13,uVar12,uVar14,uVar9,local_234);
              uVar8 = 1;
              goto LAB_0096f4ba;
            }
LAB_0096f368:
            uVar8 = 1;
            goto LAB_0096f4ba;
          }
        }
      }
      else if ((pcVar3 == "player_incapacitated") ||
              (iVar4 = _V_stricmp(pcVar3,"player_incapacitated"), iVar4 == 0)) {
        iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
        if ((iVar4 != 0) &&
           (pCVar15 = (CBasePlayer *)UTIL_PlayerByUserId(iVar4), pCVar15 != (CBasePlayer *)0x0)) {
          (**(code **)(*(int *)pCVar15 + 0xb8))(pCVar15);
          CBasePlayer::GetNetworkIDString(pCVar15);
          piVar6 = (int *)CBaseEntity::GetTeam((CBaseEntity *)pCVar15);
          (**(code **)(*piVar6 + 0x32c))(piVar6);
          uVar8 = (**(code **)(*(int *)param_1 + 0x28))(param_1,"weapon",&DAT_00d539c2);
          iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"attacker",0);
          if (iVar4 == 0) {
            iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"attackerentid",0);
            pCVar10 = (CBasePlayer *)UTIL_EntityByIndex(iVar4);
          }
          else {
            iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"attacker");
            pCVar10 = (CBasePlayer *)UTIL_PlayerByUserId(iVar4);
          }
          (**(code **)(*(int *)this + 0x14))(this,pCVar10,local_220,0x100);
          (**(code **)(*(int *)this + 0x14))(this,pCVar15,local_120,0x100);
          if (pCVar10 == pCVar15) {
            UTIL_LogPrintf("(INCAP)%s incapped self with \"%s\"\n",local_120,uVar8);
          }
          else if (pCVar10 == (CBasePlayer *)0x0) {
            UTIL_LogPrintf("(INCAP)%s was incapped from unknown attacker (probably World)\n",
                           local_120);
          }
          else {
            UTIL_LogPrintf("(INCAP)%s was incapped by %s with \"%s\"\n",local_120,local_220,uVar8);
          }
        }
      }
      else {
        iVar4 = _V_strlen("player_death");
        iVar4 = V_strncmp(pcVar3,"player_death",iVar4);
        if (iVar4 == 0) {
          iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
          if (iVar4 == 0) {
            iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"entityid",0);
            if (iVar4 != 0) {
              iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"entityid",0);
              pCVar15 = (CBasePlayer *)UTIL_EntityByIndex(iVar4);
              if (pCVar15 != (CBasePlayer *)0x0) {
                (**(code **)(*(int *)param_1 + 0x28))(param_1,"victimname",&DAT_00d539c2);
                goto LAB_0096f8bd;
              }
            }
          }
          else {
            pCVar15 = (CBasePlayer *)UTIL_PlayerByUserId(iVar4);
            if (pCVar15 != (CBasePlayer *)0x0) {
              (**(code **)(*(int *)pCVar15 + 0xb8))(pCVar15);
              CBasePlayer::GetNetworkIDString(pCVar15);
LAB_0096f8bd:
              piVar6 = (int *)CBaseEntity::GetTeam((CBaseEntity *)pCVar15);
              (**(code **)(*piVar6 + 0x32c))(piVar6);
              uVar8 = (**(code **)(*(int *)param_1 + 0x28))(param_1,"weapon",&DAT_00d539c2);
              iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"headshot",0);
              iVar5 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"attacker",0);
              if (iVar5 == 0) {
                iVar5 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"attackerentid",0);
                pCVar16 = (CBaseEntity *)UTIL_EntityByIndex(iVar5);
              }
              else {
                iVar5 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"attacker");
                pCVar16 = (CBaseEntity *)UTIL_PlayerByUserId(iVar5);
              }
              (**(code **)(*(int *)this + 0x14))(this,pCVar16,local_220,0x100);
              (**(code **)(*(int *)this + 0x14))(this,pCVar15,local_120,0x100);
              if (pCVar15 == (CBasePlayer *)pCVar16) {
                UTIL_LogPrintf("(DEATH)%s committed suicide with \"%s\"\n",local_120,uVar8);
                uVar8 = 1;
              }
              else if (pCVar16 == (CBaseEntity *)0x0) {
                UTIL_LogPrintf("(DEATH)%s died from unknown attacker (probably World)\n",local_120);
                uVar8 = 1;
              }
              else {
                pcVar3 = " (headshot)";
                if (iVar4 != 1) {
                  pcVar3 = "";
                }
                UTIL_LogPrintf("(DEATH)%s killed %s with \"%s\"%s\n",local_220,local_120,uVar8,
                               pcVar3);
                uVar8 = 1;
              }
              goto LAB_0096f4ba;
            }
          }
        }
        else {
          if ((pcVar3 == "player_spawn") || (iVar4 = _V_stricmp(pcVar3,"player_spawn"), iVar4 == 0))
          {
            iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
            iVar4 = UTIL_PlayerByUserId(iVar4);
            uVar8 = 0;
            if (iVar4 != 0) {
              (**(code **)(*(int *)this + 0x14))(this,iVar4,local_120,0x100);
              UTIL_LogPrintf("%s spawned\n",local_120);
              uVar8 = 1;
            }
            goto LAB_0096f4ba;
          }
          iVar4 = _V_strlen("round_start");
          iVar4 = V_strncmp(pcVar3,"round_start",iVar4);
          if (iVar4 == 0) {
            UTIL_LogPrintf("World triggered \"Round_Start\"\n");
            goto LAB_0096f368;
          }
        }
      }
    }
    uVar8 = 0;
    goto LAB_0096f4ba;
  }
  iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"winner",0);
  iVar5 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"reason",0);
  pcVar3 = (char *)(**(code **)(*(int *)param_1 + 0x28))(param_1,"message",&DAT_00d539c2);
  cVar1 = *pcVar3;
  if (iVar5 == 0x10) {
    UTIL_LogPrintf("World triggered \"Game_Commencing\"\n");
    uVar8 = 1;
    goto LAB_0096f4ba;
  }
  piVar6 = (int *)GetGlobalTeam(3);
  piVar7 = (int *)GetGlobalTeam(2);
  if (iVar4 == 2) {
    local_230 = (CBaseEntity *)(**(code **)(*piVar7 + 0x364))(piVar7);
    uVar8 = (**(code **)(*piVar6 + 0x364))(piVar6);
    iVar4 = *piVar7;
    piVar17 = piVar7;
LAB_0096f243:
    uVar9 = (**(code **)(iVar4 + 0x32c))(piVar17);
    UTIL_LogPrintf("Team \"%s\" triggered \"%s\" (Infected \"%i\") (Survivor \"%i\")\n",uVar9,
                   pcVar3 + (cVar1 == '#'),uVar8,local_230);
  }
  else {
    if (iVar4 == 3) {
      local_230 = (CBaseEntity *)(**(code **)(*piVar7 + 0x364))(piVar7);
      uVar8 = (**(code **)(*piVar6 + 0x364))(piVar6);
      iVar4 = *piVar6;
      piVar17 = piVar6;
      goto LAB_0096f243;
    }
    uVar8 = (**(code **)(*piVar7 + 0x364))(piVar7);
    uVar9 = (**(code **)(*piVar6 + 0x364))(piVar6);
    UTIL_LogPrintf("World triggered \"%s\" (Infected \"%i\") (Survivor \"%i\")\n",
                   pcVar3 + (cVar1 == '#'),uVar9,uVar8);
  }
  uVar9 = (**(code **)(*piVar6 + 0x354))(piVar6);
  uVar14 = (**(code **)(*piVar6 + 0x364))(piVar6);
  UTIL_LogPrintf("Team \"Infected\" scored \"%i\" with \"%i\" players\n",uVar14,uVar9,uVar8);
  uVar8 = (**(code **)(*piVar7 + 0x354))(piVar7);
  uVar9 = (**(code **)(*piVar7 + 0x364))(piVar7);
  UTIL_LogPrintf("Team \"Survivor\" scored \"%i\" with \"%i\" players\n",uVar9,uVar8);
  UTIL_LogPrintf("World triggered \"Round_End\"\n");
  uVar8 = 1;
LAB_0096f4ba:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return uVar8;
  }
                    /* 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)