L L4D2node

CCSWeaponInfo::Parse

0x0043bfc0 · 1737 bytes · __thiscall

_ZN13CCSWeaponInfo5ParseEP9KeyValuesPKc

Decompiled

undefined (3 params)

/* CCSWeaponInfo::Parse(KeyValues*, char const*) */

void __thiscall CCSWeaponInfo::Parse(CCSWeaponInfo *this,KeyValues *param_1,char *param_2)

{
  code *pcVar1;
  int iVar2;
  undefined4 uVar3;
  char *pcVar4;
  char *pcVar5;
  undefined **ppuVar6;
  longdouble lVar7;
  
  FileWeaponInfo_t::Parse((FileWeaponInfo_t *)this,param_1,param_2);
  iVar2 = KeyValues::GetInt(param_1,"MaxPlayerSpeed",1);
  *(float *)(this + 0x890) = (float)iVar2;
  uVar3 = KeyValues::GetInt(param_1,"WeaponPrice",-1);
  *(undefined4 *)(this + 0x9fc) = uVar3;
  *(undefined4 *)(this + 0xa00) = uVar3;
  lVar7 = (longdouble)KeyValues::GetFloat(param_1,"WeaponArmorRatio",1.0);
  *(float *)(this + 0x8a0) = (float)lVar7;
  uVar3 = KeyValues::GetInt(param_1,"CrosshairMinDistance",4);
  *(undefined4 *)(this + 0x8a4) = uVar3;
  uVar3 = KeyValues::GetInt(param_1,"CrosshairDeltaDistance",3);
  *(undefined4 *)(this + 0x8a8) = uVar3;
  iVar2 = KeyValues::GetInt(param_1,"CanEquipWithShield",0);
  this[0x8ac] = (CCSWeaponInfo)(iVar2 != 0);
  lVar7 = (longdouble)KeyValues::GetFloat(param_1,"MuzzleFlashScale",1.0);
  *(float *)(this + 0x9c4) = (float)lVar7;
  uVar3 = KeyValues::GetInt(param_1,"Penetration",1);
  *(undefined4 *)(this + 0x9c8) = uVar3;
  uVar3 = KeyValues::GetInt(param_1,"Damage",0x2a);
  *(undefined4 *)(this + 0x9cc) = uVar3;
  lVar7 = (longdouble)KeyValues::GetFloat(param_1,"Range",8192.0);
  *(float *)(this + 0x9d0) = (float)lVar7;
  lVar7 = (longdouble)KeyValues::GetFloat(param_1,"RangeModifier",0.98);
  *(float *)(this + 0x9d4) = (float)lVar7;
  uVar3 = KeyValues::GetInt(param_1,"Bullets",1);
  *(undefined4 *)(this + 0x9d8) = uVar3;
  lVar7 = (longdouble)KeyValues::GetFloat(param_1,"CycleTime",0.15);
  *(float *)(this + 0x9dc) = (float)lVar7;
  iVar2 = KeyValues::GetInt(param_1,"AccuracyQuadratic",0);
  this[0x9e0] = (CCSWeaponInfo)(iVar2 != 0);
  lVar7 = (longdouble)KeyValues::GetFloat(param_1,"AccuracyDivisor",-1.0);
  *(float *)(this + 0x9e4) = (float)lVar7;
  lVar7 = (longdouble)KeyValues::GetFloat(param_1,"AccuracyOffset",0.0);
  *(float *)(this + 0x9e8) = (float)lVar7;
  lVar7 = (longdouble)KeyValues::GetFloat(param_1,"MaxInaccuracy",0.0);
  *(float *)(this + 0x9ec) = (float)lVar7;
  lVar7 = (longdouble)KeyValues::GetFloat(param_1,"NoiseFactor",135.0);
  *(float *)(this + 0x9f8) = (float)lVar7;
  lVar7 = (longdouble)KeyValues::GetFloat(param_1,"TimeToIdle",2.0);
  *(float *)(this + 0x9f0) = (float)lVar7;
  lVar7 = (longdouble)KeyValues::GetFloat(param_1,"IdleInterval",20.0);
  *(undefined4 *)(this + 0x898) = 0;
  *(float *)(this + 0x9f4) = (float)lVar7;
  pcVar4 = (char *)KeyValues::GetString(param_1,"Team","");
  iVar2 = _V_stricmp(pcVar4,"Survivor");
  if (iVar2 == 0) {
    *(undefined4 *)(this + 0x898) = 2;
  }
  else {
    iVar2 = _V_stricmp(pcVar4,"Zombie");
    if (iVar2 == 0) {
      *(undefined4 *)(this + 0x898) = 3;
    }
  }
  ppuVar6 = &s_weaponTypeInfo;
  pcVar4 = (char *)KeyValues::GetString(param_1,"WrongTeamMsg","");
  V_strncpy((char *)(this + 0x8ad),pcVar4,0x20);
  pcVar4 = (char *)KeyValues::GetString(param_1,"shieldviewmodel","");
  V_strncpy((char *)(this + 0x8dd),pcVar4,0x40);
  pcVar4 = (char *)KeyValues::GetString(param_1,"PlayerAnimationExtension","m4");
  V_strncpy((char *)(this + 0x8cd),pcVar4,0x10);
  lVar7 = (longdouble)KeyValues::GetFloat(param_1,"BotAudibleRange",2000.0);
  *(float *)(this + 0x89c) = (float)lVar7;
  pcVar5 = (char *)KeyValues::GetString(param_1,"WeaponType","");
  pcVar4 = "pistol";
  do {
    if (pcVar5 != (char *)0x0) {
      iVar2 = _V_stricmp(pcVar5,pcVar4);
      if (iVar2 == 0) break;
    }
    ppuVar6 = ppuVar6 + 2;
    pcVar4 = *ppuVar6;
  } while (pcVar4 != (char *)0x0);
  *(undefined **)(this + 0x894) = ppuVar6[1];
  pcVar4 = (char *)KeyValues::GetString(param_1,"AddonModel","");
  V_strncpy((char *)(this + 0x91d),pcVar4,0x50);
  pcVar4 = (char *)KeyValues::GetString(param_1,"AddonAttachment","");
  V_strncpy((char *)(this + 0x96d),pcVar4,0x50);
  pcVar1 = *(code **)(*engine + 0x150);
  uVar3 = UTIL_VarArgs("scripts/%s.txt",param_2);
  (*pcVar1)(engine,uVar3);
  uVar3 = KeyValues::GetInt(param_1,"Tier",0);
  *(undefined4 *)(this + 0xbe8) = uVar3;
  pcVar4 = (char *)KeyValues::GetString(param_1,"ResponseRulesName","");
  V_strncpy((char *)(this + 0xa08),pcVar4,0x50);
  pcVar4 = (char *)KeyValues::GetString(param_1,"MuzzleFlashEffect_1stPerson","");
  V_strncpy((char *)(this + 0xa58),pcVar4,0x50);
  pcVar4 = (char *)KeyValues::GetString(param_1,"MuzzleFlashEffect_3rdPerson","");
  V_strncpy((char *)(this + 0xaa8),pcVar4,0x50);
  pcVar4 = (char *)KeyValues::GetString(param_1,"EjectBrassEffect","");
  V_strncpy((char *)(this + 0xaf8),pcVar4,0x50);
  lVar7 = (longdouble)KeyValues::GetFloat(param_1,"MusicDynamicSpeed",0.0);
  *(float *)(this + 0xbec) = (float)lVar7;
  pcVar4 = (char *)KeyValues::GetString(param_1,"DisplayName","");
  V_strncpy((char *)(this + 0xb48),pcVar4,0x50);
  pcVar4 = (char *)KeyValues::GetString(param_1,"DisplayNameAllCaps","");
  V_strncpy((char *)(this + 0xb98),pcVar4,0x50);
  iVar2 = KeyValues::GetInt(param_1,"NewInL4D2",0);
  this[0xbf0] = (CCSWeaponInfo)(iVar2 != 0);
  iVar2 = KeyValues::GetInt(param_1,"CSWeapon",0);
  this[0xbf1] = (CCSWeaponInfo)(iVar2 != 0);
  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)