L L4D2node

SurvivorGiveItem::SelectItemTypeToGive

0x00931340 · 259 bytes · __cdecl

_ZN16SurvivorGiveItem20SelectItemTypeToGiveEv

Decompiled

undefined (0 params)

/* SurvivorGiveItem::SelectItemTypeToGive() */

undefined4 SurvivorGiveItem::SelectItemTypeToGive(void)

{
  char cVar1;
  int iVar2;
  uint uVar3;
  int local_1c [6];
  
  local_1c[0] = 0;
  local_1c[1] = 0;
  local_1c[2] = 0;
  local_1c[3] = 0;
  ForEachSurvivor<SurvivorItemStateScan>((SurvivorItemStateScan *)local_1c);
  if (local_1c[0] < local_1c[3]) {
    cVar1 = CDirectorChallengeMode::TempHealthOnly
                      (*(CDirectorChallengeMode **)(TheDirector + 0x648));
    if (cVar1 == '\0') {
      return 0xc;
    }
  }
  else {
    cVar1 = CDirectorItemManager::L4D1SurvivorCanGiveItem
                      (*(CDirectorItemManager **)(TheDirector + 0x62c),0x14);
    if (cVar1 != '\0') {
      iVar2 = RandomInt(0,100);
      if (iVar2 < 2) {
        CDirectorItemManager::L4D1SurvivorMarkWeaponAsGiven
                  (*(CDirectorItemManager **)(TheDirector + 0x62c),0x14);
        return 0x14;
      }
      if (iVar2 < 4) {
        CDirectorItemManager::L4D1SurvivorMarkWeaponAsGiven
                  (*(CDirectorItemManager **)(TheDirector + 0x62c),0x25);
        return 0x25;
      }
    }
    uVar3 = RandomInt(0,4);
    if (uVar3 < 5) {
      return *(undefined4 *)(CSWTCH_2368 + uVar3 * 4);
    }
  }
  return 0xf;
}

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)