L L4D2node

CForgetfulAwardTemplate::FireGameEvent

0x0084f8c0 · 1530 bytes · __thiscall

_ZN23CForgetfulAwardTemplate13FireGameEventEP10IGameEvent

Decompiled

undefined (2 params)

/* CForgetfulAwardTemplate::FireGameEvent(IGameEvent*) */

void __thiscall
CForgetfulAwardTemplate::FireGameEvent(CForgetfulAwardTemplate *this,IGameEvent *param_1)

{
  float fVar1;
  char cVar2;
  char *pcVar3;
  CBaseEntity *this_00;
  int iVar4;
  CBaseEntity *pCVar5;
  CBaseEntity *pCVar6;
  undefined4 uVar7;
  longdouble lVar8;
  
  pcVar3 = (char *)(**(code **)(*(int *)param_1 + 8))(param_1);
  if (pcVar3 == (char *)0x0) {
    return;
  }
  this_00 = (CBaseEntity *)CAwardTemplate::GetOwner((CAwardTemplate *)this);
  if (this_00 == (CBaseEntity *)0x0) {
    return;
  }
  iVar4 = CBaseEntity::GetTeamNumber(this_00);
  if (iVar4 != 2) {
    return;
  }
  if ((((pcVar3 == "player_hurt") || (iVar4 = _V_stricmp(pcVar3,"player_hurt"), iVar4 == 0)) ||
      (pcVar3 == "weapon_fire")) || (iVar4 = _V_stricmp(pcVar3,"weapon_fire"), iVar4 == 0)) {
    iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
    pCVar5 = (CBaseEntity *)UTIL_PlayerByUserId(iVar4);
    if (this_00 == pCVar5) {
      CheckAndResetTimer(this);
      return;
    }
    return;
  }
  if ((pcVar3 == "revive_success") || (iVar4 = _V_stricmp(pcVar3,"revive_success"), iVar4 == 0)) {
    iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"subject",0);
    pCVar5 = (CBaseEntity *)UTIL_PlayerByUserId(iVar4);
    if (this_00 != pCVar5) {
      return;
    }
    cVar2 = DoesOwnerHaveHealthItem(this);
    if (cVar2 != '\0') goto LAB_0084fb9b;
LAB_0084fafd:
    fVar1 = *(float *)(this + 0x14);
  }
  else {
    if (((pcVar3 == "player_incapacitated") ||
        (iVar4 = _V_stricmp(pcVar3,"player_incapacitated"), iVar4 == 0)) ||
       ((pcVar3 == "player_death" || (iVar4 = _V_stricmp(pcVar3,"player_death"), iVar4 == 0)))) {
      iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
      pCVar5 = (CBaseEntity *)UTIL_PlayerByUserId(iVar4);
      if (this_00 != pCVar5) {
        return;
      }
      CheckAndResetTimer(this);
      if (this[0x18] != (CForgetfulAwardTemplate)0x0) {
        (**(code **)(*(int *)this + 0x14))(this,0x61,0);
      }
      goto LAB_0084fafd;
    }
    if ((pcVar3 != "weapon_given") && (iVar4 = _V_stricmp(pcVar3,"weapon_given"), iVar4 != 0)) {
      if ((pcVar3 == "item_pickup") || (iVar4 = _V_stricmp(pcVar3,"item_pickup"), iVar4 == 0)) {
        iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
        pCVar5 = (CBaseEntity *)UTIL_PlayerByUserId(iVar4);
        pcVar3 = (char *)(**(code **)(*(int *)param_1 + 0x28))(param_1,"item",&DAT_00d539c2);
        if ((((pcVar3 != "first_aid_kit") &&
             (iVar4 = _V_stricmp(pcVar3,"first_aid_kit"), iVar4 != 0)) &&
            (pcVar3 = (char *)(**(code **)(*(int *)param_1 + 0x28))(param_1,"item",&DAT_00d539c2),
            pcVar3 != "pain_pills")) && (iVar4 = _V_stricmp(pcVar3,"pain_pills"), iVar4 != 0)) {
          return;
        }
        if (this_00 != pCVar5) {
          return;
        }
        cVar2 = DoesOwnerHaveHealthItem(this);
        if ((cVar2 == '\0') ||
           (iVar4 = *(int *)(this_00 + 0x100),
           lVar8 = (longdouble)(**(code **)(*(int *)this_00 + 0x7e4))(this_00),
           *(float *)(SurvivorLimpHealth._28_4_ + 0x2c) <= (float)lVar8 + (float)iVar4)) {
          if (*(float *)(this + 0x14) != -1.0) {
            IntervalTimer::NetworkVar_m_timestamp::NetworkStateChanged(this + 0x14);
            *(undefined4 *)(this + 0x14) = 0xbf800000;
            return;
          }
          return;
        }
        goto LAB_0084fb9b;
      }
      if (((pcVar3 != "heal_success") && (iVar4 = _V_stricmp(pcVar3,"heal_success"), iVar4 != 0)) &&
         ((pcVar3 != "pills_used" && (iVar4 = _V_stricmp(pcVar3,"pills_used"), iVar4 != 0)))) {
        if ((pcVar3 != "map_transition") &&
           (iVar4 = _V_stricmp(pcVar3,"map_transition"), iVar4 != 0)) {
          return;
        }
        cVar2 = DoesOwnerHaveHealthItem(this);
        if ((cVar2 != '\0') &&
           (iVar4 = *(int *)(this_00 + 0x100),
           lVar8 = (longdouble)(**(code **)(*(int *)this_00 + 0x7e4))(this_00),
           (float)lVar8 + (float)iVar4 < *(float *)(SurvivorLimpHealth._28_4_ + 0x2c))) {
          if (*(float *)(this + 0x14) != 0.0) {
            IntervalTimer::NetworkVar_m_timestamp::NetworkStateChanged(this + 0x14);
            *(undefined4 *)(this + 0x14) = 0;
            return;
          }
          return;
        }
        if (*(float *)(this + 0x14) != -1.0) {
          (**(code **)(*(int *)(this + 0x10) + 4))(this + 0x10,this + 0x14);
          *(undefined4 *)(this + 0x14) = 0xbf800000;
          return;
        }
        return;
      }
      iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"subject",0);
      pCVar5 = (CBaseEntity *)UTIL_PlayerByUserId(iVar4);
      if (this_00 != pCVar5) {
        return;
      }
      if (*(float *)(this + 0x14) != -1.0) {
        IntervalTimer::NetworkVar_m_timestamp::NetworkStateChanged(this + 0x14);
        *(undefined4 *)(this + 0x14) = 0xbf800000;
      }
      goto LAB_0084fb12;
    }
    iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
    pCVar5 = (CBaseEntity *)UTIL_PlayerByUserId(iVar4);
    iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"giver",0);
    pCVar6 = (CBaseEntity *)UTIL_PlayerByUserId(iVar4);
    uVar7 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"weapon",0);
    iVar4 = GetWeaponInfo(uVar7);
    if (iVar4 == 0) {
      return;
    }
    if (*(int *)(iVar4 + 0x894) != 8) {
      return;
    }
    if ((this_00 != pCVar6) && (this_00 != pCVar5)) {
      return;
    }
    cVar2 = DoesOwnerHaveHealthItem(this);
    if ((cVar2 != '\0') &&
       (iVar4 = *(int *)(pCVar5 + 0x100),
       lVar8 = (longdouble)(**(code **)(*(int *)pCVar5 + 0x7e4))(pCVar5),
       (float)lVar8 + (float)iVar4 < *(float *)(SurvivorLimpHealth._28_4_ + 0x2c))) {
LAB_0084fb9b:
      IntervalTimer::Start((IntervalTimer *)(this + 0x10));
      return;
    }
    fVar1 = *(float *)(this + 0x14);
  }
  if (fVar1 != -1.0) {
    (**(code **)(*(int *)(this + 0x10) + 4))(this + 0x10,this + 0x14);
    *(undefined4 *)(this + 0x14) = 0xbf800000;
  }
LAB_0084fb12:
  this[0x18] = (CForgetfulAwardTemplate)0x0;
  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)