L L4D2node

CBasePlayer::ModifyOrAppendPlayerCriteria

0x007a9400 · 462 bytes · __thiscall

_ZN11CBasePlayer28ModifyOrAppendPlayerCriteriaER14AI_CriteriaSet

Decompiled

undefined (2 params)

/* CBasePlayer::ModifyOrAppendPlayerCriteria(AI_CriteriaSet&) */

void __thiscall CBasePlayer::ModifyOrAppendPlayerCriteria(CBasePlayer *this,AI_CriteriaSet *param_1)

{
  char *pcVar1;
  int iVar2;
  int iVar3;
  double dVar4;
  
  pcVar1 = (char *)UTIL_VarArgs("%i",*(undefined4 *)(this + 0x100));
  AI_CriteriaSet::AppendCriteria(param_1,"playerhealth",pcVar1,1.0);
  iVar2 = (**(code **)(*(int *)this + 0x1fc))(this);
  dVar4 = 0.0;
  if (0 < iVar2) {
    iVar2 = *(int *)(this + 0x100);
    iVar3 = (**(code **)(*(int *)this + 0x1fc))(this);
    dVar4 = (double)((float)iVar2 / (float)iVar3);
  }
  pcVar1 = (char *)UTIL_VarArgs("%.3f",dVar4);
  AI_CriteriaSet::AppendCriteria(param_1,"playerhealthfrac",pcVar1,1.0);
  iVar2 = CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this);
  if (iVar2 == 0) {
    AI_CriteriaSet::AppendCriteria(param_1,"playerweapon","none",1.0);
  }
  else {
    pcVar1 = "";
    if (*(char **)(iVar2 + 0x7c) != (char *)0x0) {
      pcVar1 = *(char **)(iVar2 + 0x7c);
    }
    AI_CriteriaSet::AppendCriteria(param_1,"playerweapon",pcVar1,1.0);
  }
  pcVar1 = (char *)CAI_BaseNPC::GetActivityName(*(int *)(this + 0x1cf8));
  AI_CriteriaSet::AppendCriteria(param_1,"playeractivity",pcVar1,1.0);
  if (((byte)this[0x14d] & 0x10) != 0) {
    CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
  }
  pcVar1 = (char *)UTIL_VarArgs("%.3f",(double)SQRT(*(float *)(this + 0x274) *
                                                    *(float *)(this + 0x274) +
                                                    *(float *)(this + 0x27c) *
                                                    *(float *)(this + 0x27c) +
                                                    *(float *)(this + 0x278) *
                                                    *(float *)(this + 0x278)));
  AI_CriteriaSet::AppendCriteria(param_1,"playerspeed",pcVar1,1.0);
  CBaseEntity::AppendContextToCriteria((CBaseEntity *)this,param_1,"player");
  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)