Skip to content

Commit 041838a

Browse files
Adding LastPlaceName method for Player, adding new project to README (#312)
* added LastPlayerPlace and updated README * common: m_szLastPlaceName is on player-entity, not resource-entity Co-authored-by: Markus <[email protected]>
1 parent 253aaff commit 041838a

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ There is one caveat however: Beta features - which are marked as such via commen
216216
- [csgoverview](https://github.com/Linus4/csgoverview) - A 2D demo replay tool for CS:GO
217217
- [csgo-coach-bug-detector](https://github.com/softarn/csgo-coach-bug-detector) - Detects the abuse of an exploit used by some team coaches in professional matches
218218
- [megaclan3000](https://github.com/megaclan3000/megaclan3000) - A CS:GO stats page for clans with recent matches and player statistics
219+
- [csgo Python library](https://github.com/pnxenopoulos/csgo) - A wrapper for the Golang parser in Python
219220

220221
If your project is using this library feel free to submit a PR or send a message in [Gitter](https://gitter.im/csgodemos/demoinfo-lib) to be included in the list.
221222

pkg/demoinfocs/common/player.go

+5
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,11 @@ func (p *Player) MoneySpentThisRound() int {
447447
return getInt(p.resourceEntity(), "m_iCashSpentThisRound."+p.entityIDStr())
448448
}
449449

450+
// LastPlaceName returns the string value of the player's position.
451+
func (p *Player) LastPlaceName() string {
452+
return getString(p.Entity, "m_szLastPlaceName")
453+
}
454+
450455
type demoInfoProvider interface {
451456
IngameTick() int // current in-game tick, used for IsBlinded()
452457
TickRate() float64 // in-game tick rate, used for Player.IsBlinded()

pkg/demoinfocs/common/player_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,12 @@ func TestPlayer_SteamID32(t *testing.T) {
465465
assert.Equal(t, uint32(52686539), pl.SteamID32())
466466
}
467467

468+
func TestPlayer_LastPlaceName(t *testing.T) {
469+
pl := playerWithProperty("m_szLastPlaceName", st.PropertyValue{StringVal: "TopofMid"})
470+
471+
assert.Equal(t, "TopofMid", pl.LastPlaceName())
472+
}
473+
468474
func newPlayer(tick int) *Player {
469475
return NewPlayer(mockDemoInfoProvider(128, tick))
470476
}

0 commit comments

Comments
 (0)