Skip to content

Commit

Permalink
Streaks system.
Browse files Browse the repository at this point in the history
  • Loading branch information
zyro committed Sep 30, 2024
1 parent 99ffbf0 commit f8ce7d7
Show file tree
Hide file tree
Showing 8 changed files with 1,722 additions and 679 deletions.
11 changes: 11 additions & 0 deletions base.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ type Hiro interface {
GetProgressionSystem() ProgressionSystem
GetIncentivesSystem() IncentivesSystem
GetAuctionsSystem() AuctionsSystem
GetStreaksSystem() StreaksSystem
}

// The SystemType identifies each of the gameplay systems.
Expand All @@ -119,6 +120,7 @@ const (
SystemTypeProgression
SystemTypeIncentives
SystemTypeAuctions
SystemTypeStreaks
)

// Init initializes a Hiro type with the configurations provided.
Expand Down Expand Up @@ -345,6 +347,15 @@ func WithAuctionsSystem(configFile string, register bool) SystemConfig {
}
}

// WithStreaksSystem configures a StreaksSystem type and optionally registers its RPCs with the game server.
func WithStreaksSystem(configFile string, register bool) SystemConfig {
return &systemConfig{
systemType: SystemTypeStreaks,
configFile: configFile,
register: register,
}
}

// UnregisterRpc clears the implementation of one or more RPCs registered in Nakama by Hiro gameplay systems with a
// no-op version (http response 404). This is useful to remove individual RPCs which you do not want to be callable by
// game clients:
Expand Down
47 changes: 47 additions & 0 deletions definitions/17-Hiro-Streaks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"streaks": {
"wins": {
"name": "Consecutive Wins",
"count": 0,
"max_count": 9,
"max_count_current_reset": 3,
"idle_count_decay_reset": 9,
"reset_cronexpr": "0 0 * * *",
"rewards": [
{
"count_min": 3,
"count_max": 3,
"reward": {
"guaranteed": {
"currencies": {
"coins": 10
}
}
}
},
{
"count_min": 6,
"count_max": 6,
"reward": {
"guaranteed": {
"currencies": {
"coins": 30
}
}
}
},
{
"count_min": 9,
"count_max": 9,
"reward": {
"guaranteed": {
"currencies": {
"coins": 100
}
}
}
}
]
}
}
}
Loading

0 comments on commit f8ce7d7

Please sign in to comment.