-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrocketpass.go
More file actions
155 lines (134 loc) · 5.18 KB
/
rocketpass.go
File metadata and controls
155 lines (134 loc) · 5.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
package rlapi
import "context"
// RocketPassInfo represents information about a player's Rocket Pass progress
type RocketPassInfo struct {
TierLevel int `json:"TierLevel"`
OwnsPremium bool `json:"bOwnsPremium"`
XPMultiplier float64 `json:"XPMultiplier"`
Pips int `json:"Pips"`
PipsPerLevel int `json:"PipsPerLevel"`
}
// RocketPassStore represents purchasable items in the Rocket Pass store
type RocketPassStore struct {
Tiers []RocketPassTier `json:"Tiers"`
Bundles []RocketPassBundle `json:"Bundles"`
}
// RocketPassTier represents a purchasable tier in the Rocket Pass
type RocketPassTier struct {
PurchasableID int `json:"PurchasableID"`
CurrencyID int `json:"CurrencyID"`
CurrencyCost int `json:"CurrencyCost"`
OriginalCurrencyCost *int `json:"OriginalCurrencyCost"`
Tiers int `json:"Tiers"`
Savings int `json:"Savings"`
ImageURL *string `json:"ImageUrl"`
}
// RocketPassBundle represents a purchasable bundle in the Rocket Pass
type RocketPassBundle struct {
PurchasableID int `json:"PurchasableID"`
CurrencyID int `json:"CurrencyID"`
CurrencyCost int `json:"CurrencyCost"`
OriginalCurrencyCost *int `json:"OriginalCurrencyCost"`
Tiers int `json:"Tiers"`
Savings int `json:"Savings"`
ImageURL *string `json:"ImageUrl"`
}
// RocketPassReward represents rewards available at specified tiers
type RocketPassReward struct {
Tier int `json:"Tier"`
ProductData []Product `json:"ProductData"`
XPRewards []XPReward `json:"XPRewards"`
CurrencyDrops []CurrencyDrop `json:"CurrencyDrops"`
}
// XPReward represents an XP-based reward
type XPReward struct {
Name string `json:"Name"`
Amount float64 `json:"Amount"`
}
// CurrencyDrop represents a currency reward
type CurrencyDrop struct {
ID int `json:"ID"`
CurrencyID int `json:"CurrencyID"`
Amount int `json:"Amount"`
}
// PrestigeReward represents a prestige reward in Rocket Pass
type PrestigeReward struct {
Level int `json:"Level"`
ProductData []Product `json:"ProductData"`
Currency []interface{} `json:"Currency"`
}
type GetPlayerInfoRequest struct {
PlayerID PlayerID `json:"PlayerID"`
RocketPassID int `json:"RocketPassID"`
RocketPassInfo interface{} `json:"RocketPassInfo"`
RocketPassStore interface{} `json:"RocketPassStore"`
}
type GetPlayerInfoResponse struct {
StartTime int `json:"StartTime"`
EndTime int `json:"EndTime"`
RocketPassInfo RocketPassInfo `json:"RocketPassInfo"`
RocketPassStore RocketPassStore `json:"RocketPassStore"`
}
type GetRewardContentRequest struct {
RocketPassID int `json:"RocketPassID"`
TierCap int `json:"TierCap"`
FreeMaxLevel int `json:"FreeMaxLevel"`
PremiumMaxLevel int `json:"PremiumMaxLevel"`
}
type GetRewardContentResponse struct {
TierCap int `json:"TierCap"`
FreeMaxLevel int `json:"FreeMaxLevel"`
PremiumMaxLevel int `json:"PremiumMaxLevel"`
FreeRewards []RocketPassReward `json:"FreeRewards"`
PremiumRewards []RocketPassReward `json:"PremiumRewards"`
}
type GetPlayerPrestigeRewardsRequest struct {
PlayerID PlayerID `json:"PlayerID"`
RocketPassID int `json:"RocketPassID"`
}
type GetPlayerPrestigeRewardsResponse struct {
PrestigeRewards []PrestigeReward `json:"PrestigeRewards"`
}
// GetRocketPassPlayerInfo retrieves Rocket Pass information for the authenticated player.
func (p *PsyNetRPC) GetRocketPassPlayerInfo(ctx context.Context, rocketPassID int) (*GetPlayerInfoResponse, error) {
request := GetPlayerInfoRequest{
PlayerID: p.localPlayerID,
RocketPassID: rocketPassID,
RocketPassInfo: map[string]interface{}{},
RocketPassStore: map[string]interface{}{},
}
var result GetPlayerInfoResponse
err := p.sendRequestSync(ctx, "RocketPass/GetPlayerInfo v2", request, &result)
if err != nil {
return nil, err
}
return &result, nil
}
// GetRocketPassRewardContent retrieves the reward content for the given Rocket Pass.
func (p *PsyNetRPC) GetRocketPassRewardContent(ctx context.Context, rocketPassID, tierCap, freeMaxLevel, premiumMaxLevel int) (*GetRewardContentResponse, error) {
request := GetRewardContentRequest{
RocketPassID: rocketPassID,
TierCap: tierCap,
FreeMaxLevel: freeMaxLevel,
PremiumMaxLevel: premiumMaxLevel,
}
var result GetRewardContentResponse
err := p.sendRequestSync(ctx, "RocketPass/GetRewardContent v1", request, &result)
if err != nil {
return nil, err
}
return &result, nil
}
// GetRocketPassPrestigeRewards retrieves prestige rewards for the authenticated player's Rocket Pass.
func (p *PsyNetRPC) GetRocketPassPrestigeRewards(ctx context.Context, rocketPassID int) ([]PrestigeReward, error) {
request := GetPlayerPrestigeRewardsRequest{
PlayerID: p.localPlayerID,
RocketPassID: rocketPassID,
}
var result GetPlayerPrestigeRewardsResponse
err := p.sendRequestSync(ctx, "RocketPass/GetPlayerPrestigeRewards v1", request, &result)
if err != nil {
return nil, err
}
return result.PrestigeRewards, nil
}