CTerrorPlayer::OnAwardEarned
0x009b5750 · 1440 bytes · __thiscall
_ZN13CTerrorPlayer13OnAwardEarnedE9AwardTypeP11CBaseEntity
Decompiled
undefined (3 params)
/* CTerrorPlayer::OnAwardEarned(AwardType, CBaseEntity*) */
void __thiscall CTerrorPlayer::OnAwardEarned(CTerrorPlayer *this,int param_2,int *param_3)
{
code *pcVar1;
CBaseEdict *this_00;
char cVar2;
int iVar3;
int iVar4;
int *piVar5;
undefined4 uVar6;
int iVar7;
char *pcVar8;
undefined4 *puVar9;
int in_GS_OFFSET;
byte bVar10;
int *local_140;
int local_138;
int *local_134;
CTerrorPlayer *local_130;
undefined4 local_12c;
undefined4 local_128;
undefined1 local_124;
undefined4 local_120;
undefined4 local_11c [63];
int local_20;
bVar10 = 0;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
local_140 = param_3;
iVar3 = param_2 * 4;
iVar7 = *(int *)(this + iVar3 + 0x3410) + 1;
local_138 = iVar7;
iVar4 = memcmp(this + iVar3 + 0x3410,&local_138,4);
if (iVar4 != 0) {
if (this[0x6c] == (CTerrorPlayer)0x0) {
this_00 = *(CBaseEdict **)(this + 0x30);
if (this_00 != (CBaseEdict *)0x0) {
*(uint *)this_00 = *(uint *)this_00 | 0x101;
iVar4 = CBaseEdict::GetChangeAccessor(this_00);
*(undefined2 *)(iVar4 + 2) = 0;
}
*(int *)(this + iVar3 + 0x3410) = iVar7;
}
else {
this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
*(int *)(this + iVar3 + 0x3410) = iVar7;
}
}
if ((param_3 == (int *)0x0) || (cVar2 = (**(code **)(*param_3 + 0x16c))(param_3), cVar2 == '\0'))
{
local_140 = (int *)0x0;
}
piVar5 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"award_earned",0,0);
if (piVar5 != (int *)0x0) {
pcVar1 = *(code **)(*piVar5 + 0x30);
uVar6 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
(*pcVar1)(piVar5,"userid",uVar6);
if (*(int *)(this + 0x30) == 0) {
iVar7 = 0;
}
else {
iVar7 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
(**(code **)(*piVar5 + 0x30))(piVar5,"entityid",iVar7);
if (param_3 != (int *)0x0) {
if (param_3[0xc] == 0) {
iVar7 = 0;
}
else {
iVar7 = param_3[0xc] - *(int *)(gpGlobals + 0x58) >> 4;
}
(**(code **)(*piVar5 + 0x30))(piVar5,"subjectentid",iVar7);
}
(**(code **)(*piVar5 + 0x30))(piVar5,"award",param_2);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar5,0);
}
iVar7 = TerrorAward::GetCategoryFromType(param_2);
if (iVar7 == 2) {
puVar9 = local_11c;
for (iVar7 = 0x3f; iVar7 != 0; iVar7 = iVar7 + -1) {
*puVar9 = 0;
puVar9 = puVar9 + (uint)bVar10 * -2 + 1;
}
local_120 = 0;
pcVar8 = (char *)TerrorAward::GetResponseNameFromType(param_2);
V_strncat((char *)&local_120,"FaultName:",0x100,-1);
V_strncat((char *)&local_120,pcVar8,0x100,-1);
if (local_140 != (int *)0x0) {
V_strncat((char *)&local_120,",Subject:",0x100,-1);
pcVar8 = (char *)SurvivorCharacterName(local_140[0xae8]);
V_strncat((char *)&local_120,pcVar8,0x100,-1);
}
pcVar1 = *(code **)(*(int *)this + 0x7b4);
CAI_Concept::CAI_Concept((CAI_Concept *)&local_138,"Fault");
(*pcVar1)(this,&local_138,1,&local_120,0,0,0);
iVar7 = TerrorAward::GetCategoryFromType(param_2);
}
else {
iVar7 = TerrorAward::GetCategoryFromType(param_2);
}
if (iVar7 == 1) {
puVar9 = local_11c;
for (iVar7 = 0x3f; iVar7 != 0; iVar7 = iVar7 + -1) {
*puVar9 = 0;
puVar9 = puVar9 + (uint)bVar10 * -2 + 1;
}
local_120 = 0;
pcVar8 = (char *)TerrorAward::GetResponseNameFromType(param_2);
V_strncat((char *)&local_120,"AwardName:",0x100,-1);
V_strncat((char *)&local_120,pcVar8,0x100,-1);
if (local_140 != (int *)0x0) {
V_strncat((char *)&local_120,",Subject:",0x100,-1);
pcVar8 = (char *)SurvivorCharacterName(local_140[0xae8]);
V_strncat((char *)&local_120,pcVar8,0x100,-1);
}
pcVar1 = *(code **)(*(int *)this + 0x7b4);
CAI_Concept::CAI_Concept((CAI_Concept *)&local_138,"Award");
(*pcVar1)(this,&local_138,1,&local_120,0,0,0);
}
if (local_140 != (int *)0x0) {
switch(param_2) {
case 0x42:
case 0x4b:
case 0x4c:
local_138 = 0xf;
break;
case 0x43:
local_138 = 0x12;
break;
case 0x44:
local_138 = 0x10;
break;
case 0x45:
local_138 = 0x11;
break;
case 0x46:
local_138 = 0x14;
break;
default:
goto switchD_009b5905_caseD_47;
case 0x50:
local_138 = 0x13;
}
local_130 = this;
local_134 = local_140;
local_12c = 0;
local_124 = 0;
local_128 = 0;
ForEachTerrorPlayer<HitAnnouncement>((HitAnnouncement *)&local_138);
}
switchD_009b5905_caseD_47:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* 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.