Skip to content

Commit dc3f4b8

Browse files
committed
various deprecation cleanups for v2
1 parent 2d9876b commit dc3f4b8

File tree

11 files changed

+11
-35
lines changed

11 files changed

+11
-35
lines changed

examples/print-events/print_events.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func main() {
5757
})
5858

5959
p.RegisterEventHandler(func(e events.RankUpdate) {
60-
fmt.Printf("Rank Update: %d went from rank %d to rank %d, change: %f\n", e.SteamID, e.RankOld, e.RankNew, e.RankChange)
60+
fmt.Printf("Rank Update: %d went from rank %d to rank %d, change: %f\n", e.SteamID32, e.RankOld, e.RankNew, e.RankChange)
6161
})
6262

6363
// Parse to end

pkg/demoinfocs/common/common.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func (ts TeamState) FreezeTimeEndEquipmentValue() (value int) {
170170
// CashSpentThisRound returns the total amount of cash spent by the whole team in the current round.
171171
func (ts TeamState) CashSpentThisRound() (value int) {
172172
for _, pl := range ts.Members() {
173-
value += pl.AdditionalPlayerInformation.CashSpentThisRound
173+
value += pl.AdditionalInformation.CashSpentThisRound
174174
}
175175

176176
return
@@ -179,7 +179,7 @@ func (ts TeamState) CashSpentThisRound() (value int) {
179179
// CashSpentThisRound returns the total amount of cash spent by the whole team during the whole game up to the current point.
180180
func (ts TeamState) CashSpentTotal() (value int) {
181181
for _, pl := range ts.Members() {
182-
value += pl.AdditionalPlayerInformation.TotalCashSpent
182+
value += pl.AdditionalInformation.CashSpentTotal
183183
}
184184

185185
return

pkg/demoinfocs/common/common_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ func TestTeamState_FreezeTimeEndEquipmentValue(t *testing.T) {
8282

8383
func TestTeamState_CashSpentThisRound(t *testing.T) {
8484
members := []*Player{
85-
{AdditionalPlayerInformation: &AdditionalPlayerInformation{CashSpentThisRound: 100}},
86-
{AdditionalPlayerInformation: &AdditionalPlayerInformation{CashSpentThisRound: 200}},
85+
{AdditionalInformation: &AdditionalPlayerInformation{CashSpentThisRound: 100}},
86+
{AdditionalInformation: &AdditionalPlayerInformation{CashSpentThisRound: 200}},
8787
}
8888
state := NewTeamState(TeamTerrorists, func(Team) []*Player { return members })
8989

@@ -92,8 +92,8 @@ func TestTeamState_CashSpentThisRound(t *testing.T) {
9292

9393
func TestTeamState_CashSpentTotal(t *testing.T) {
9494
members := []*Player{
95-
{AdditionalPlayerInformation: &AdditionalPlayerInformation{TotalCashSpent: 100}},
96-
{AdditionalPlayerInformation: &AdditionalPlayerInformation{TotalCashSpent: 200}},
95+
{AdditionalInformation: &AdditionalPlayerInformation{CashSpentTotal: 100}},
96+
{AdditionalInformation: &AdditionalPlayerInformation{CashSpentTotal: 200}},
9797
}
9898
state := NewTeamState(TeamTerrorists, func(Team) []*Player { return members })
9999

pkg/demoinfocs/common/equipment.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ const (
5252
EqDeagle EquipmentType = 4
5353
EqFiveSeven EquipmentType = 5
5454
EqDualBerettas EquipmentType = 6
55-
EqDualBarettas EquipmentType = 6 // Deprecated, use EqDualBerettas instead (spelling error)
5655
EqTec9 EquipmentType = 7
5756
EqCZ EquipmentType = 8
5857
EqUSP EquipmentType = 9

pkg/demoinfocs/common/player.go

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type Player struct {
3636
Inventory map[int]*Equipment // All weapons / equipment the player is currently carrying
3737
AmmoLeft [32]int // Ammo left for special weapons (e.g. grenades), index corresponds Equipment.AmmoType
3838
Entity st.IEntity // May be nil between player-death and re-spawn
39-
AdditionalPlayerInformation *AdditionalPlayerInformation // Mostly scoreboard information such as kills, deaths, etc.
39+
AdditionalInformation *AdditionalPlayerInformation // Mostly scoreboard information such as kills, deaths, etc.
4040
ViewDirectionX float32 // Yaw in degrees, 0 to 360
4141
ViewDirectionY float32 // Pitch in degrees, 270 to 90 (270=-90)
4242
FlashDuration float32 // Blindness duration from the flashbang currently affecting the player (seconds)
@@ -194,20 +194,6 @@ func (p *Player) IsScoped() bool {
194194
return p.Entity.FindProperty("m_bIsScoped").Value().IntVal == 1
195195
}
196196

197-
// CashSpentThisRound returns the amount of cash the player spent in the current round.
198-
//
199-
// Deprecated, use Player.AdditionalPlayerInformation.CashSpentThisRound instead.
200-
func (p *Player) CashSpentThisRound() int {
201-
return p.AdditionalPlayerInformation.CashSpentThisRound
202-
}
203-
204-
// CashSpentTotal returns the amount of cash the player spent during the whole game up to the current point.
205-
//
206-
// Deprecated, use Player.AdditionalPlayerInformation.TotalCashSpent instead.
207-
func (p *Player) CashSpentTotal() int {
208-
return p.AdditionalPlayerInformation.TotalCashSpent
209-
}
210-
211197
// IsControllingBot returns true if the player is currently controlling a bot.
212198
// See also ControlledBot().
213199
func (p *Player) IsControllingBot() bool {
@@ -239,7 +225,7 @@ type AdditionalPlayerInformation struct {
239225
MVPs int
240226
Ping int
241227
ClanTag string
242-
TotalCashSpent int
228+
CashSpentTotal int
243229
CashSpentThisRound int
244230
}
245231

pkg/demoinfocs/datatables.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ func (p *Parser) bindPlayers() {
187187
plInfo.BindProperty("m_iDeaths."+iStr, &p.additionalPlayerInfo[i2].Deaths, st.ValTypeInt)
188188
plInfo.BindProperty("m_iAssists."+iStr, &p.additionalPlayerInfo[i2].Assists, st.ValTypeInt)
189189
plInfo.BindProperty("m_iMVPs."+iStr, &p.additionalPlayerInfo[i2].MVPs, st.ValTypeInt)
190-
plInfo.BindProperty("m_iTotalCashSpent."+iStr, &p.additionalPlayerInfo[i2].TotalCashSpent, st.ValTypeInt)
190+
plInfo.BindProperty("m_iTotalCashSpent."+iStr, &p.additionalPlayerInfo[i2].CashSpentTotal, st.ValTypeInt)
191191
if prop := plInfo.FindProperty("m_iCashSpentThisRound." + iStr); prop != nil {
192192
prop.Bind(&p.additionalPlayerInfo[i2].CashSpentThisRound, st.ValTypeInt)
193193
}
@@ -239,7 +239,7 @@ func (p *Parser) bindNewPlayer(playerEntity st.IEntity) {
239239

240240
pl.EntityID = entityID
241241
pl.Entity = playerEntity
242-
pl.AdditionalPlayerInformation = &p.additionalPlayerInfo[entityID]
242+
pl.AdditionalInformation = &p.additionalPlayerInfo[entityID]
243243
pl.IsConnected = true
244244

245245
playerEntity.OnDestroy(func() {

pkg/demoinfocs/events/events.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ import (
1414
msg "github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs/msg"
1515
)
1616

17-
// TickDone is deprecated, use the identical FrameDone event instead.
18-
// It does NOT signal the end of a tick, it signals the end of a demo-frame instead.
19-
type TickDone struct{}
20-
2117
// FrameDone signals that a demo-frame has been processed.
2218
// A frame can contain multiple ticks (usually 2 or 4) if the tv_snapshotrate differs from the tick-rate the game was played at.
2319
type FrameDone struct{}
@@ -414,7 +410,6 @@ type ChatMessage struct {
414410
// RankUpdate signals the new rank. Not sure if this
415411
// only occurs if the rank changed.
416412
type RankUpdate struct {
417-
SteamID int64 // 32-bit SteamID. Deprecated, use SteamID32 instead
418413
SteamID32 int32
419414
RankChange float32
420415
RankOld int

pkg/demoinfocs/parsing.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,6 @@ func (p *Parser) handleFrameParsed(*frameParsedTokenType) {
366366
p.delayedEventHandlers = p.delayedEventHandlers[:0]
367367

368368
p.currentFrame++
369-
p.eventDispatcher.Dispatch(events.TickDone{})
370369
p.eventDispatcher.Dispatch(events.FrameDone{})
371370
}
372371

pkg/demoinfocs/user_messages.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ func (umh userMessageHandler) rankUpdate(um *msg.CSVCMsg_UserMessage) {
120120

121121
for _, v := range st.RankUpdate {
122122
umh.dispatch(events.RankUpdate{
123-
SteamID: int64(v.AccountId),
124123
SteamID32: v.AccountId,
125124
RankOld: int(v.RankOld),
126125
RankNew: int(v.RankNew),

pkg/demoinfocs/user_messages_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,12 @@ func Test_UserMessages_ServerRankUpdate(t *testing.T) {
4444
p.handleUserMessage(um)
4545

4646
expected := []events.RankUpdate{{
47-
SteamID: 123,
4847
SteamID32: 123,
4948
RankOld: 1,
5049
RankNew: 2,
5150
WinCount: 5,
5251
RankChange: 1,
5352
}, {
54-
SteamID: 456,
5553
SteamID32: 456,
5654
RankOld: 2,
5755
RankNew: 3,

0 commit comments

Comments
 (0)