@@ -292,49 +292,54 @@ func (p *Player) entityIDStr() string {
292292 return fmt .Sprintf ("%03d" , p .EntityID )
293293}
294294
295+ // ResourceEntity returns the player's CCSPlayerResource entity.
296+ func (p * Player ) ResourceEntity () st.Entity {
297+ return p .demoInfoProvider .PlayerResourceEntity ()
298+ }
299+
295300// ClanTag returns the player's individual clan tag (Steam Groups etc.).
296301func (p * Player ) ClanTag () string {
297- return getString (p .demoInfoProvider . PlayerResourceEntity (), "m_szClan." + p .entityIDStr ())
302+ return getString (p .ResourceEntity (), "m_szClan." + p .entityIDStr ())
298303}
299304
300305// Ping returns the players latency to the game server.
301306func (p * Player ) Ping () int {
302- return getInt (p .demoInfoProvider . PlayerResourceEntity (), "m_iPing." + p .entityIDStr ())
307+ return getInt (p .ResourceEntity (), "m_iPing." + p .entityIDStr ())
303308}
304309
305310// Score returns the players score as shown on the scoreboard.
306311func (p * Player ) Score () int {
307- return getInt (p .demoInfoProvider . PlayerResourceEntity (), "m_iScore." + p .entityIDStr ())
312+ return getInt (p .ResourceEntity (), "m_iScore." + p .entityIDStr ())
308313}
309314
310315// Kills returns the amount of kills the player has as shown on the scoreboard.
311316func (p * Player ) Kills () int {
312- return getInt (p .demoInfoProvider . PlayerResourceEntity (), "m_iKills." + p .entityIDStr ())
317+ return getInt (p .ResourceEntity (), "m_iKills." + p .entityIDStr ())
313318}
314319
315320// Deaths returns the amount of deaths the player has as shown on the scoreboard.
316321func (p * Player ) Deaths () int {
317- return getInt (p .demoInfoProvider . PlayerResourceEntity (), "m_iDeaths." + p .entityIDStr ())
322+ return getInt (p .ResourceEntity (), "m_iDeaths." + p .entityIDStr ())
318323}
319324
320325// Assists returns the amount of assists the player has as shown on the scoreboard.
321326func (p * Player ) Assists () int {
322- return getInt (p .demoInfoProvider . PlayerResourceEntity (), "m_iAssists." + p .entityIDStr ())
327+ return getInt (p .ResourceEntity (), "m_iAssists." + p .entityIDStr ())
323328}
324329
325330// MVPs returns the amount of Most-Valuable-Player awards the player has as shown on the scoreboard.
326331func (p * Player ) MVPs () int {
327- return getInt (p .demoInfoProvider . PlayerResourceEntity (), "m_iMVPs." + p .entityIDStr ())
332+ return getInt (p .ResourceEntity (), "m_iMVPs." + p .entityIDStr ())
328333}
329334
330335// MoneySpentTotal returns the total amount of money the player has spent in the current match.
331336func (p * Player ) MoneySpentTotal () int {
332- return getInt (p .demoInfoProvider . PlayerResourceEntity (), "m_iTotalCashSpent." + p .entityIDStr ())
337+ return getInt (p .ResourceEntity (), "m_iTotalCashSpent." + p .entityIDStr ())
333338}
334339
335340// MoneySpentThisRound returns the amount of money the player has spent in the current round.
336341func (p * Player ) MoneySpentThisRound () int {
337- return getInt (p .demoInfoProvider . PlayerResourceEntity (), "m_iCashSpentThisRound." + p .entityIDStr ())
342+ return getInt (p .ResourceEntity (), "m_iCashSpentThisRound." + p .entityIDStr ())
338343}
339344
340345type demoInfoProvider interface {
0 commit comments