Include ID and dependancy in zqds file
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
53e70b1eba
commit
1313f2caf9
1 changed files with 13 additions and 1 deletions
|
@ -7,11 +7,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type ChallengeZQDS struct {
|
type ChallengeZQDS struct {
|
||||||
|
ID int64 `json:"id,omitempty"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Type string `json:"type,omitempty"`
|
Type string `json:"type,omitempty"`
|
||||||
Category string `json:"category"`
|
Category string `json:"category"`
|
||||||
Points int64 `json:"points"`
|
Points int64 `json:"points"`
|
||||||
State string `json:"state"`
|
State string `json:"state"`
|
||||||
|
LockedBy []int64 `json:"locked_by,omitempty"`
|
||||||
FirstBloodBonus []float64 `json:"first_blood_bonus,omitempty"`
|
FirstBloodBonus []float64 `json:"first_blood_bonus,omitempty"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
Flags []string `json:"flags,omitempty"`
|
Flags []string `json:"flags,omitempty"`
|
||||||
|
@ -43,12 +45,22 @@ func GenZQDSSessionFile(c *settings.ChallengeInfo, s *settings.Settings) (*Sessi
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, ex := range exos {
|
for _, ex := range exos {
|
||||||
|
state := "visible"
|
||||||
|
lockedby := []int64{}
|
||||||
|
|
||||||
|
if ex.Depend != nil {
|
||||||
|
state = "locked"
|
||||||
|
lockedby = append(lockedby, *ex.Depend)
|
||||||
|
}
|
||||||
|
|
||||||
challenges = append(challenges, &ChallengeZQDS{
|
challenges = append(challenges, &ChallengeZQDS{
|
||||||
|
ID: ex.Id,
|
||||||
Name: ex.Title,
|
Name: ex.Title,
|
||||||
Type: "first_blood",
|
Type: "first_blood",
|
||||||
Category: th.Name,
|
Category: th.Name,
|
||||||
Points: ex.Gain,
|
Points: ex.Gain,
|
||||||
State: "visible",
|
State: state,
|
||||||
|
LockedBy: lockedby,
|
||||||
FirstBloodBonus: []float64{
|
FirstBloodBonus: []float64{
|
||||||
float64(ex.Gain) * (1 + s.FirstBlood),
|
float64(ex.Gain) * (1 + s.FirstBlood),
|
||||||
},
|
},
|
||||||
|
|
Reference in a new issue