CAchievementMsgHandler::FireGameEvent
0x004e73c0 · 1092 bytes · __thiscall
_ZN22CAchievementMsgHandler13FireGameEventEP10IGameEvent
Decompiled
undefined (2 params)
/* CAchievementMsgHandler::FireGameEvent(IGameEvent*) */
void __thiscall
CAchievementMsgHandler::FireGameEvent(CAchievementMsgHandler *this,IGameEvent *param_1)
{
uint uVar1;
code *pcVar2;
char cVar3;
char *pcVar4;
int iVar5;
CBaseEntity *this_00;
int *piVar6;
undefined4 uVar7;
int local_20 [4];
pcVar4 = (char *)(**(code **)(*(int *)param_1 + 8))(param_1);
if (pcVar4 == (char *)0x0) {
return;
}
iVar5 = _V_strcmp(pcVar4,"weapon_fire");
if (iVar5 != 0) {
iVar5 = _V_strcmp(pcVar4,"round_start_pre_entity");
if ((iVar5 == 0) || (iVar5 = _V_strcmp(pcVar4,"survival_round_start"), iVar5 == 0)) {
*(undefined4 *)(this + 0x24) = 0;
*(undefined4 *)(this + 0x38) = 0;
return;
}
iVar5 = _V_strcmp(pcVar4,"player_hurt");
if (iVar5 != 0) {
return;
}
iVar5 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
this_00 = (CBaseEntity *)UTIL_PlayerByUserId(iVar5);
if (this_00 == (CBaseEntity *)0x0) {
return;
}
cVar3 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
if (cVar3 == '\0') {
return;
}
iVar5 = CBaseEntity::GetTeamNumber(this_00);
if (iVar5 != 2) {
return;
}
piVar6 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"player_hurt_concise",0,0);
if (piVar6 == (int *)0x0) {
return;
}
pcVar2 = *(code **)(*piVar6 + 0x30);
uVar7 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
(*pcVar2)(piVar6,"userid",uVar7);
pcVar2 = *(code **)(*piVar6 + 0x30);
uVar7 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"attackerentid",0);
(*pcVar2)(piVar6,"attackerentid",uVar7);
pcVar2 = *(code **)(*piVar6 + 0x30);
uVar7 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"dmg_health",0);
(*pcVar2)(piVar6,"dmg_health",uVar7);
pcVar2 = *(code **)(*piVar6 + 0x30);
uVar7 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"type",0);
(*pcVar2)(piVar6,"type",uVar7);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar6,0);
return;
}
iVar5 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"weaponid",0);
if (iVar5 == 0) {
uVar7 = (**(code **)(*(int *)param_1 + 0x28))(param_1,"weapon",&DAT_00d539c2);
DevMsg("weapon_fire message for %s is missing weapon ID!\n",uVar7);
return;
}
local_20[0] = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
iVar5 = GetWeaponInfo(iVar5);
if (iVar5 == 0) {
return;
}
uVar1 = *(uint *)(iVar5 + 0x894);
if (0 < *(int *)(this + 0x24)) {
if (**(int **)(this + 0x18) == local_20[0]) goto LAB_004e7555;
iVar5 = 0;
do {
iVar5 = iVar5 + 1;
if (iVar5 == *(int *)(this + 0x24)) goto LAB_004e74a0;
} while ((*(int **)(this + 0x18))[iVar5] != local_20[0]);
if (iVar5 != -1) goto LAB_004e7555;
}
LAB_004e74a0:
if ((((uVar1 != 0) && (uVar1 != 0xd)) && (2 < uVar1 - 7)) &&
(piVar6 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"non_pistol_fired",0,0), piVar6 != (int *)0x0)) {
pcVar2 = *(code **)(*piVar6 + 0x30);
uVar7 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
(*pcVar2)(piVar6,"userid",uVar7);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar6,0);
CUtlVector<int,CUtlMemory<int,int>>::InsertBefore
((CUtlVector<int,CUtlMemory<int,int>> *)(this + 0x18),*(int *)(this + 0x24),local_20);
}
LAB_004e7555:
if (0 < *(int *)(this + 0x38)) {
if (**(int **)(this + 0x2c) == local_20[0]) {
return;
}
iVar5 = 0;
do {
iVar5 = iVar5 + 1;
if (iVar5 == *(int *)(this + 0x38)) goto LAB_004e7580;
} while ((*(int **)(this + 0x2c))[iVar5] != local_20[0]);
if (iVar5 != -1) {
return;
}
}
LAB_004e7580:
if ((((uVar1 & 0xfffffffd) != 0xd) && (4 < uVar1 - 7)) &&
(piVar6 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"non_melee_fired",0,0), piVar6 != (int *)0x0)) {
pcVar2 = *(code **)(*piVar6 + 0x30);
uVar7 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
(*pcVar2)(piVar6,"userid",uVar7);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar6,0);
CUtlVector<int,CUtlMemory<int,int>>::InsertBefore
((CUtlVector<int,CUtlMemory<int,int>> *)(this + 0x2c),*(int *)(this + 0x38),local_20);
}
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.