diff --git a/pkg/demoinfocs/common/equipment.go b/pkg/demoinfocs/common/equipment.go index 731f77ce..24c87fe2 100644 --- a/pkg/demoinfocs/common/equipment.go +++ b/pkg/demoinfocs/common/equipment.go @@ -165,6 +165,7 @@ func initEqNameToWeapon() { eqNameToWeapon["hkp2000"] = EqP2000 eqNameToWeapon["incgrenade"] = EqIncendiary eqNameToWeapon["incendiarygrenade"] = EqIncendiary + eqNameToWeapon["inferno"] = EqIncendiary eqNameToWeapon["m249"] = EqM249 eqNameToWeapon["m4a1"] = EqM4A4 eqNameToWeapon["mac10"] = EqMac10 diff --git a/pkg/demoinfocs/game_events.go b/pkg/demoinfocs/game_events.go index 4e579cb5..39609ab5 100644 --- a/pkg/demoinfocs/game_events.go +++ b/pkg/demoinfocs/game_events.go @@ -470,6 +470,11 @@ func (geh gameEventHandler) playerDeath(data map[string]*msg.CSVCMsg_GameEventKe victimUserID := data["userid"].GetValShort() wepType = geh.attackerWeaponType(wepType, victimUserID) + if killer == nil && data["attacker_pawn"] != nil { + // CS2 only, fallback to pawn handle if the killer was not found by its user ID + killer = geh.parser.gameState.Participants().FindByPawnHandle(uint64(data["attacker_pawn"].GetValLong())) + } + geh.dispatch(events.Kill{ Victim: geh.playerByUserID32(data["userid"].GetValShort()), Killer: killer, @@ -997,7 +1002,18 @@ func (geh gameEventHandler) bombPickup(data map[string]*msg.CSVCMsg_GameEventKey // Just so we can nicely create GrenadeEvents in one line func (geh gameEventHandler) nadeEvent(data map[string]*msg.CSVCMsg_GameEventKeyT, nadeType common.EquipmentType) events.GrenadeEvent { - thrower := geh.playerByUserID32(data["userid"].GetValShort()) + var thrower *common.Player + // Sometimes only the position and the entityid are present. + // Since GetValShort() returns 0 for nil values, the thrower would be the player with UserID 0, so we need to check for the existence of the key. + if data["userid"] != nil { + thrower = geh.playerByUserID32(data["userid"].GetValShort()) + } + + // CS2 only - userid may be missing, but userid_pawn present. + if thrower == nil && data["userid_pawn"] != nil { + thrower = geh.gameState().Participants().FindByPawnHandle(uint64(data["userid_pawn"].GetValLong())) + } + position := r3.Vector{ X: float64(data["x"].GetValFloat()), Y: float64(data["y"].GetValFloat()), diff --git a/pkg/demoinfocs/net_messages.go b/pkg/demoinfocs/net_messages.go index dc4fafae..49671bd1 100644 --- a/pkg/demoinfocs/net_messages.go +++ b/pkg/demoinfocs/net_messages.go @@ -141,6 +141,7 @@ func (p *parser) handleMessageSayText2(msg *msgs2.CUserMessageSayText2) { case "#CSGO_Coach_Join_T": // Ignore these case "#CSGO_Coach_Join_CT": + case "#CSGO_No_Longer_Coach": case "#Cstrike_Name_Change": case "Cstrike_Chat_T_Loc": case "Cstrike_Chat_CT_Loc": diff --git a/pkg/demoinfocs/user_messages.go b/pkg/demoinfocs/user_messages.go index 62169787..31159c0b 100644 --- a/pkg/demoinfocs/user_messages.go +++ b/pkg/demoinfocs/user_messages.go @@ -107,6 +107,7 @@ func (umh userMessageHandler) sayText2(um *msg.CSVCMsg_UserMessage) { case "#CSGO_Coach_Join_T": // Ignore these case "#CSGO_Coach_Join_CT": + case "#CSGO_No_Longer_Coach": case "#Cstrike_Name_Change": case "Cstrike_Chat_T_Loc": case "Cstrike_Chat_CT_Loc":