L L4D2node

ScavengeScan::IsFavoriteWeapon

0x00963fa0 · 453 bytes · __thiscall

_ZN12ScavengeScan16IsFavoriteWeaponE10CSWeaponID

Decompiled

undefined (2 params)

/* ScavengeScan::IsFavoriteWeapon(CSWeaponID) */

undefined4 __thiscall ScavengeScan::IsFavoriteWeapon(ScavengeScan *this,undefined4 param_2)

{
  char cVar1;
  int iVar2;
  int iVar3;
  CWeaponCSBase *pCVar4;
  bool bVar5;
  
  iVar2 = GetWeaponInfo(param_2);
  if (iVar2 == 0) {
    return 0;
  }
  bVar5 = *(int *)(iVar2 + 0xbe8) != 2;
  iVar2 = *(int *)(iVar2 + 0x894);
  iVar3 = ConvertToExternalCharacter(*(undefined4 *)(*(int *)this + 0x2ba0));
  if (iVar3 == 3) {
LAB_009640e0:
    if (bVar5) {
      return 0;
    }
    cVar1 = CTerrorGameRules::HasPlayerControlledZombies();
    if ((cVar1 == '\0') && (cVar1 = CTerrorGameRules::IsSurvivalMode(), cVar1 == '\0')) {
      if (iVar2 != 4) {
        return 0;
      }
      pCVar4 = (CWeaponCSBase *)(**(code **)(**(int **)this + 0x484))(*(int **)this,0);
      if (pCVar4 == (CWeaponCSBase *)0x0) {
        return 1;
      }
      iVar2 = CWeaponCSBase::GetCSWpnData(pCVar4);
      if (*(int *)(iVar2 + 0x894) != 4) {
        return 1;
      }
      return 0;
    }
LAB_009640f3:
    if (iVar2 != 3) {
      return 0;
    }
  }
  else {
    if (iVar3 < 4) {
      if (iVar3 != 2) {
LAB_00964090:
        if (iVar2 != 2) {
          return 0;
        }
        if (bVar5) {
          return 0;
        }
        pCVar4 = (CWeaponCSBase *)(**(code **)(**(int **)this + 0x484))(*(int **)this,0);
        if (pCVar4 == (CWeaponCSBase *)0x0) {
          return 1;
        }
        iVar2 = CWeaponCSBase::GetCSWpnData(pCVar4);
        if (*(int *)(iVar2 + 0x894) != 2) {
          return 1;
        }
        goto LAB_0096405e;
      }
      if (bVar5) {
        if (iVar2 != 3) {
          return 0;
        }
        pCVar4 = (CWeaponCSBase *)(**(code **)(**(int **)this + 0x484))(*(int **)this,0);
        if ((pCVar4 != (CWeaponCSBase *)0x0) &&
           (iVar2 = CWeaponCSBase::GetCSWpnData(pCVar4), *(int *)(iVar2 + 0x894) == 3)) {
          return 0;
        }
        goto LAB_0096405e;
      }
      goto LAB_009640f3;
    }
    if (iVar3 == 5) goto LAB_009640e0;
    if (iVar3 != 6) goto LAB_00964090;
    if (iVar2 != 3) {
      return 0;
    }
    if (bVar5) {
      return 0;
    }
  }
  pCVar4 = (CWeaponCSBase *)(**(code **)(**(int **)this + 0x484))(*(int **)this,0);
  if (pCVar4 == (CWeaponCSBase *)0x0) {
    return 1;
  }
  iVar2 = CWeaponCSBase::GetCSWpnData(pCVar4);
  if (*(int *)(iVar2 + 0x894) != 3) {
    return 1;
  }
LAB_0096405e:
  pCVar4 = (CWeaponCSBase *)(**(code **)(**(int **)this + 0x484))(*(int **)this,0);
  if ((pCVar4 != (CWeaponCSBase *)0x0) &&
     (iVar2 = CWeaponCSBase::GetCSWpnData(pCVar4), *(int *)(iVar2 + 0xbe8) == 2)) {
    return 0;
  }
  return 1;
}

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)