CTerrorPlayer::AddUpgrade
0x009b1c20 · 640 bytes · __thiscall
_ZN13CTerrorPlayer10AddUpgradeE19SurvivorUpgradeType
Decompiled
undefined (2 params)
/* CTerrorPlayer::AddUpgrade(SurvivorUpgradeType) */
undefined4 __thiscall CTerrorPlayer::AddUpgrade(CTerrorPlayer *this,undefined4 param_2)
{
code *pcVar1;
int iVar2;
int *piVar3;
undefined4 uVar4;
undefined4 uVar5;
int in_GS_OFFSET;
CAI_Concept local_134 [8];
CFmtStrN<256> local_12c [5];
undefined1 local_127 [263];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
iVar2 = GetUpgradeInfo(param_2);
if (iVar2 != 0) {
piVar3 = (int *)(**(code **)(*(int *)this + 0x484))(this,0);
if (piVar3 == (int *)0x0) {
piVar3 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"upgrade_failed_no_primary",0,0);
if (piVar3 != (int *)0x0) {
pcVar1 = *(code **)(*piVar3 + 0x30);
uVar4 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
(*pcVar1)(piVar3,"userid",uVar4);
pcVar1 = *(code **)(*piVar3 + 0x3c);
uVar4 = UpgradeToString(param_2);
(*pcVar1)(piVar3,"upgrade",uVar4);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar3,0);
}
}
else {
uVar4 = (**(code **)(*piVar3 + 0x6a8))(piVar3,param_2);
if ((char)uVar4 != '\0') {
CCSPlayer::EmitPrivateSound((CCSPlayer *)this,"Player.AwardUpgrade");
piVar3 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"receive_upgrade",0,0);
if (piVar3 != (int *)0x0) {
pcVar1 = *(code **)(*piVar3 + 0x30);
uVar5 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
(*pcVar1)(piVar3,"userid",uVar5);
pcVar1 = *(code **)(*piVar3 + 0x3c);
uVar5 = UpgradeToString(param_2);
(*pcVar1)(piVar3,"upgrade",uVar5);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar3,0);
}
if (*(int *)(iVar2 + 0x20) != 0) {
pcVar1 = *(code **)(*(int *)this + 0x7b4);
CFmtStrN<256>::CFmtStrN(local_12c,"ItemPickedUp:%s",*(int *)(iVar2 + 0x20));
CAI_Concept::CAI_Concept(local_134,"PlayerPickup");
(*pcVar1)(this,local_134,3,local_127,0,0,0);
}
goto LAB_009b1c80;
}
}
}
uVar4 = 0;
LAB_009b1c80:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return uVar4;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.