L L4D2node

SurvivorBot::GetAvoidRange

0x00939b80 · 797 bytes · __thiscall

_ZNK11SurvivorBot13GetAvoidRangeEP11CBaseEntity

Decompiled

undefined (2 params)

/* SurvivorBot::GetAvoidRange(CBaseEntity*) const */

longdouble __thiscall SurvivorBot::GetAvoidRange(SurvivorBot *this,CBaseEntity *param_1)

{
  uint uVar1;
  char cVar2;
  undefined4 uVar3;
  int *piVar4;
  undefined *puVar5;
  int iVar6;
  CBaseEntity *pCVar7;
  longdouble lVar8;
  float fVar9;
  
  if (param_1 != (CBaseEntity *)0x0) {
    uVar3 = CTerrorPlayer::ClassifyZombie(param_1);
    switch(uVar3) {
    case 0:
      iVar6 = CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this);
      if ((iVar6 != 0) && (*(char *)(iVar6 + 0x1459) != '\0')) {
LAB_00939c20:
        return (longdouble)125.0;
      }
      piVar4 = (int *)(**(code **)(*(int *)this + 0x9ac))(this);
      iVar6 = (**(code **)(*piVar4 + 0xc0))(piVar4,3,0x43fa0000);
      if (4 < iVar6) goto LAB_00939c20;
      break;
    case 1:
    case 3:
    case 4:
    case 5:
    case 6:
      cVar2 = (**(code **)(*(int *)param_1 + 0x16c))(param_1);
      pCVar7 = (CBaseEntity *)0x0;
      if (cVar2 != '\0') {
        pCVar7 = param_1;
      }
      lVar8 = (longdouble)CountdownTimer::Now();
      if (*(float *)(pCVar7 + 0x32dc) <= (float)lVar8) goto LAB_00939c20;
      break;
    case 2:
      piVar4 = (int *)(**(code **)(*(int *)this + 0x9ac))(this);
      cVar2 = (**(code **)(*piVar4 + 0xf8))(piVar4,param_1,0);
      fVar9 = 450.0;
      if (cVar2 == '\0') goto LAB_00939bd0;
      cVar2 = (**(code **)(*(int *)param_1 + 0x16c))(param_1);
      pCVar7 = (CBaseEntity *)0x0;
      if (cVar2 != '\0') {
        pCVar7 = param_1;
      }
      uVar1 = *(uint *)(pCVar7 + 0x30bc);
      if ((((uVar1 == 0xffffffff) ||
           (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 == (undefined *)0xfffffffc)) ||
          (*(uint *)(puVar5 + 8) != uVar1 >> 0xc)) ||
         ((*(int *)(puVar5 + 4) == 0 ||
          (lVar8 = (longdouble)CountdownTimer::Now(), (float)lVar8 < *(float *)(pCVar7 + 0x32dc)))))
      {
LAB_00939de0:
        return (longdouble)(*(float *)(ZombieExplodingOuterRadius._28_4_ + 0x2c) * 1.1);
      }
      uVar1 = *(uint *)(pCVar7 + 0x30bc);
      piVar4 = (int *)0x0;
      if ((uVar1 != 0xffffffff) &&
         ((puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc &&
          (*(uint *)(puVar5 + 8) == uVar1 >> 0xc)))) {
        piVar4 = *(int **)(puVar5 + 4);
      }
      cVar2 = (**(code **)(*piVar4 + 0x32c))(piVar4);
      if (cVar2 == '\0') goto LAB_00939de0;
      if (((*(int *)(pCVar7 + 0x337c) + -1 <= *(int *)(pCVar7 + 0x338c)) &&
          ((((iVar6 = CBaseEntity::GetTeamNumber(pCVar7), iVar6 == 3 &&
             (iVar6 = (**(code **)(*(int *)pCVar7 + 0x544))(pCVar7), iVar6 == 2)) ||
            ((iVar6 = CBaseEntity::GetTeamNumber(pCVar7), iVar6 == 3 &&
             (iVar6 = (**(code **)(*(int *)pCVar7 + 0x544))(pCVar7), iVar6 == 1)))) ||
           ((iVar6 = CBaseEntity::GetTeamNumber(pCVar7), iVar6 == 3 &&
            (iVar6 = (**(code **)(*(int *)pCVar7 + 0x544))(pCVar7), iVar6 == 3)))))) ||
         (cVar2 = (**(code **)(*(int *)(this + 0x4028) + 0x114))(this + 0x4028,pCVar7,0x42c80000),
         cVar2 == '\0')) {
        fVar9 = 500.0;
        goto LAB_00939bd0;
      }
      break;
    case 7:
      return (longdouble)300.0;
    case 8:
      return (longdouble)450.0;
    default:
      if ((*(char **)(param_1 + 0x7c) == "pipe_bomb_projectile") ||
         (cVar2 = CBaseEntity::ClassMatchesComplex(param_1,"pipe_bomb_projectile"), cVar2 != '\0'))
      {
        fVar9 = 425.0;
        goto LAB_00939bd0;
      }
    }
  }
  fVar9 = 0.0;
LAB_00939bd0:
  return (longdouble)fVar9;
}

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)