Include ID and dependancy in zqds file
continuous-integration/drone/push Build is passing Details

This commit is contained in:
nemunaire 2022-05-02 12:08:05 +02:00
parent 53e70b1eba
commit 1313f2caf9
1 changed files with 13 additions and 1 deletions

View File

@ -7,11 +7,13 @@ import (
)
type ChallengeZQDS struct {
ID int64 `json:"id,omitempty"`
Name string `json:"name"`
Type string `json:"type,omitempty"`
Category string `json:"category"`
Points int64 `json:"points"`
State string `json:"state"`
LockedBy []int64 `json:"locked_by,omitempty"`
FirstBloodBonus []float64 `json:"first_blood_bonus,omitempty"`
Description string `json:"description"`
Flags []string `json:"flags,omitempty"`
@ -43,12 +45,22 @@ func GenZQDSSessionFile(c *settings.ChallengeInfo, s *settings.Settings) (*Sessi
}
for _, ex := range exos {
state := "visible"
lockedby := []int64{}
if ex.Depend != nil {
state = "locked"
lockedby = append(lockedby, *ex.Depend)
}
challenges = append(challenges, &ChallengeZQDS{
ID: ex.Id,
Name: ex.Title,
Type: "first_blood",
Category: th.Name,
Points: ex.Gain,
State: "visible",
State: state,
LockedBy: lockedby,
FirstBloodBonus: []float64{
float64(ex.Gain) * (1 + s.FirstBlood),
},