SurvivorGiveItem::OnStart
0x00931460 · 962 bytes · __thiscall
_ZN16SurvivorGiveItem7OnStartEP11SurvivorBotP6ActionIS0_E
Decompiled
undefined (3 params)
/* SurvivorGiveItem::OnStart(SurvivorBot*, Action<SurvivorBot>*) */
SurvivorGiveItem * __thiscall
SurvivorGiveItem::OnStart(SurvivorGiveItem *this,SurvivorBot *param_1,Action *param_2)
{
code *pcVar1;
uint uVar2;
char cVar3;
undefined4 uVar4;
SurvivorBot *pSVar5;
int *piVar6;
undefined4 *puVar7;
int *piVar8;
undefined *puVar9;
int in_GS_OFFSET;
longdouble lVar10;
Action *pAVar11;
undefined1 *puVar12;
code *local_144;
CAI_Concept *local_140;
CAI_Concept local_134 [8];
CFmtStrN<256> local_12c [5];
undefined1 local_127 [263];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
uVar4 = SelectItemTypeToGive();
*(undefined4 *)(param_1 + 0x48) = uVar4;
pcVar1 = *(code **)(*(int *)param_2 + 0x6c0);
uVar4 = WeaponIDToClassname(uVar4);
pAVar11 = param_2;
pSVar5 = (SurvivorBot *)(*pcVar1)(param_2,uVar4,0,1,0);
if (pSVar5 != (SurvivorBot *)0x0) {
piVar6 = (int *)(**(code **)(*(int *)pSVar5 + 0x188))(pSVar5);
pAVar11 = (Action *)pSVar5;
if (piVar6 != (int *)0x0) {
puVar7 = (undefined4 *)(**(code **)(*piVar6 + 0xc))(piVar6);
*(undefined4 *)(param_1 + 0x38) = *puVar7;
piVar8 = (int *)CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)param_2);
if (piVar8 != piVar6) {
pAVar11 = param_2;
cVar3 = (**(code **)(*(int *)param_2 + 0x474))(param_2,piVar6,0);
if (cVar3 == '\0') {
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "Unable to switch to the item we\'re trying to give.";
goto LAB_00931539;
}
}
uVar2 = *(uint *)(param_1 + 0x34);
if ((((uVar2 == 0xffffffff) ||
(puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar9 + 8) != uVar2 >> 0xc)) || (*(int *)(puVar9 + 4) == 0)) {
local_144 = *(code **)(*(int *)param_2 + 0x7b4);
CAI_Concept::CAI_Concept(local_134,"SurvivorBotTakeThisItem");
puVar12 = (undefined1 *)0x0;
}
else {
piVar6 = (int *)(**(code **)(*(int *)param_2 + 0x9a4))(param_2);
local_140 = (CAI_Concept *)0x0;
uVar2 = *(uint *)(param_1 + 0x34);
if (((uVar2 != 0xffffffff) &&
(puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar9 + 8) == uVar2 >> 0xc)) {
local_140 = *(CAI_Concept **)(puVar9 + 4);
}
(**(code **)(*piVar6 + 0xc4))
(piVar6,local_140,2,0x3f800000,0,"Looking at who I might give an item to",1,
0x3e800000);
local_140 = (CAI_Concept *)0x0;
uVar2 = *(uint *)(param_1 + 0x34);
if (((uVar2 != 0xffffffff) &&
(puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar9 + 8) == uVar2 >> 0xc)) {
local_140 = *(CAI_Concept **)(puVar9 + 4);
}
uVar4 = SurvivorCharacterName(*(undefined4 *)((int)local_140 + 0x2ba0));
CFmtStrN<256>::CFmtStrN(local_12c,"GiveTarget:%s",uVar4);
local_144 = *(code **)(*(int *)param_2 + 0x7b4);
CAI_Concept::CAI_Concept(local_134,"SurvivorBotTakeThisItem");
puVar12 = local_127;
}
local_140 = local_134;
pSVar5 = param_1 + 0x3c;
(*local_144)(param_2,local_140,1,puVar12,0,0,0);
pAVar11 = (Action *)pSVar5;
lVar10 = (longdouble)CountdownTimer::Now();
if ((float)lVar10 + 2.0 != *(float *)(param_1 + 0x44)) {
pAVar11 = (Action *)pSVar5;
(**(code **)(*(int *)(param_1 + 0x3c) + 4))(pSVar5,param_1 + 0x44);
*(float *)(param_1 + 0x44) = (float)lVar10 + 2.0;
}
if (*(float *)(param_1 + 0x40) != 2.0) {
(**(code **)(*(int *)(param_1 + 0x3c) + 4))(pSVar5,param_1 + 0x40);
*(undefined4 *)(param_1 + 0x40) = 0x40000000;
pAVar11 = (Action *)pSVar5;
}
*(undefined4 *)this = 0;
*(undefined4 *)(this + 4) = 0;
*(undefined4 *)(this + 8) = 0;
goto LAB_00931539;
}
}
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "Unable to give myself the item to give";
LAB_00931539:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return this;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail(pAVar11);
}
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.