L L4D2node

CL4DGameStats::AddDataForSend

0x008e18e0 · 699 bytes · __thiscall

_ZN13CL4DGameStats14AddDataForSendEP9KeyValues14StatSendType_t

Decompiled

undefined (3 params)

/* CL4DGameStats::AddDataForSend(KeyValues*, StatSendType_t) */

undefined4 __thiscall
CL4DGameStats::AddDataForSend(CL4DGameStats *this,KeyValues *param_1,int param_3)

{
  CSteamWorksGameStatsUploader *pCVar1;
  char cVar2;
  int iVar3;
  int *piVar4;
  KeyValues *this_00;
  ConVarRef local_14 [4];
  int local_10;
  
  if (param_3 != 0) {
    return 0;
  }
  if (this[0x70] == (CL4DGameStats)0x0) {
    cVar2 = CTerrorGameRules::IsVersusMode();
    if ((((cVar2 != '\0') || (cVar2 = CTerrorGameRules::IsCoopMode(), cVar2 != '\0')) ||
        (cVar2 = CTerrorGameRules::IsRealismMode(), cVar2 != '\0')) &&
       (((g_pMatchExtL4D != (int *)0x0 && (g_pMatchFramework != (int *)0x0)) &&
        (iVar3 = (**(code **)(*g_pMatchFramework + 0x28))(g_pMatchFramework), iVar3 != 0)))) {
      piVar4 = (int *)(**(code **)(*g_pMatchFramework + 0x28))(g_pMatchFramework);
      this_00 = (KeyValues *)(**(code **)(*piVar4 + 4))(piVar4,0);
      if (this_00 != (KeyValues *)0x0) {
                    /* try { // try from 008e1a6a to 008e1a9e has its CatchHandler @ 008e1bc3 */
        iVar3 = KeyValues::GetInt(this_00,"Game/chapter",0);
        KeyValues::SetInt(this_00,"Game/chapter",iVar3 + 1);
        iVar3 = (**(code **)(*g_pMatchExtL4D + 8))(g_pMatchExtL4D,this_00,0);
        pCVar1 = steamGameStats;
        if (iVar3 == 0) {
          this[0x70] = (CL4DGameStats)0x1;
                    /* try { // try from 008e1bb9 to 008e1bbd has its CatchHandler @ 008e1bc3 */
          CSteamWorksGameStatsUploader::SetExitStatus(pCVar1,2);
        }
        KeyValues::deleteThis();
      }
    }
    if (((this[0x70] == (CL4DGameStats)0x0) && (g_pMatchFramework != (int *)0x0)) &&
       ((iVar3 = (**(code **)(*g_pMatchFramework + 0x24))(g_pMatchFramework), iVar3 == 0 &&
        (((engine != (int *)0x0 && (cVar2 = (**(code **)(*engine + 0x1f8))(engine), cVar2 == '\0'))
         && (cVar2 = (**(code **)(*engine + 8))(engine), pCVar1 = steamGameStats, cVar2 == '\0')))))
       ) {
      this[0x70] = (CL4DGameStats)0x1;
      CSteamWorksGameStatsUploader::SetExitStatus(pCVar1,6);
    }
  }
  if (((this[0x3ac] == (CL4DGameStats)0x0) || (*(int *)(l4d_stats_track._28_4_ + 0x30) == 0)) &&
     (this[0x70] == (CL4DGameStats)0x0)) {
    (**(code **)(*(int *)this + 0x30))(this);
    return 0;
  }
  if (param_1 != (KeyValues *)0x0) {
    ConVarRef::ConVarRef(local_14,"sv_cheats");
    KeyValues::SetInt(param_1,"Cheats",*(int *)(local_10 + 0x30));
  }
  AddMapStats(this);
  AddZombieStats(this);
  cVar2 = CTerrorGameRules::HasPlayerControlledZombies();
  if (cVar2 == '\0') {
    AddSurvivorStats(this,false);
  }
  if (steamGameStats[0x371] != (CSteamWorksGameStatsUploader)0x0) {
    AddWeaponStats(this);
  }
  AddAchievementStats(this);
  AddZombieDurationAttackStats(this);
  AddDeathStats(this);
  AddStuckStats(this);
  cVar2 = CTerrorGameRules::IsVersusMode();
  if (cVar2 != '\0') {
    AddCompetitiveStats(this);
  }
  if (this[0x70] != (CL4DGameStats)0x0) {
    CSteamWorksGameStatsUploader::SendSessionStats(steamGameStats);
  }
  (**(code **)(*(int *)this + 0x30))(this);
  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)