CBaseUpgradeItem::Use
0x00a081b0 · 535 bytes · __cdecl
_ZN16CBaseUpgradeItem3UseEP11CBaseEntityS1_8USE_TYPEf
Decompiled
undefined (4 params)
/* CBaseUpgradeItem::Use(CBaseEntity*, CBaseEntity*, USE_TYPE, float) */
void CBaseUpgradeItem::Use(CBaseUpgradeItem *param_1,CTerrorPlayer *param_2)
{
CBaseUpgradeItem *pCVar1;
code *pcVar2;
char cVar3;
int iVar4;
int *piVar5;
undefined4 uVar6;
undefined1 *puVar7;
undefined4 uVar8;
if (param_2 != (CTerrorPlayer *)0x0) {
cVar3 = (**(code **)(*(int *)param_2 + 0x16c))(param_2);
if (cVar3 != '\0') {
iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_2);
cVar3 = IsASurvivorTeam(iVar4);
if (cVar3 != '\0') {
uVar6 = *(undefined4 *)(param_2 + 0x2ba0);
cVar3 = HasBeenUsedBySurvivor(param_1,uVar6);
if (cVar3 == '\0') {
uVar8 = (**(code **)(*(int *)param_1 + 0x3f0))(param_1);
cVar3 = CTerrorPlayer::AddUpgrade(param_2,uVar8);
if (cVar3 != '\0') {
piVar5 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"upgrade_pack_added",0,0);
if (piVar5 != (int *)0x0) {
if (*(int *)(param_1 + 0x30) == 0) {
iVar4 = 0;
}
else {
iVar4 = *(int *)(param_1 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
(**(code **)(*piVar5 + 0x30))(piVar5,"upgradeid",iVar4);
pcVar2 = *(code **)(*piVar5 + 0x30);
uVar8 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(param_2 + 0x30));
(*pcVar2)(piVar5,"userid",uVar8);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar5,0);
}
cVar3 = (**(code **)(*(int *)param_1 + 0x3f4))(param_1);
if (cVar3 != '\0') {
MarkAsUsedBySurvivor(param_1,uVar6);
pCVar1 = param_1 + 0x144c;
*(int *)pCVar1 = *(int *)pCVar1 + -1;
if (*(int *)pCVar1 == 0) {
VisibilityMonitor_RemoveEntity((CBaseEntity *)param_1);
UTIL_Remove((CBaseEntity *)param_1);
return;
}
}
}
}
else {
piVar5 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"upgrade_item_already_used",0,0);
if (piVar5 != (int *)0x0) {
pcVar2 = *(code **)(*piVar5 + 0x30);
uVar6 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(param_2 + 0x30));
(*pcVar2)(piVar5,"userid",uVar6);
puVar7 = &DAT_00d539c2;
if (*(undefined1 **)(param_1 + 0x7c) != (undefined1 *)0x0) {
puVar7 = *(undefined1 **)(param_1 + 0x7c);
}
(**(code **)(*piVar5 + 0x3c))(piVar5,"upgradeclass",puVar7);
/* WARNING: Could not recover jumptable at 0x00a082aa. Too many branches */
/* WARNING: Treating indirect jump as call */
(**(code **)(*gameeventmanager + 0x20))();
return;
}
}
}
}
}
return;
}
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.