This repository has been archived by the owner on Jul 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
skills.go
140 lines (117 loc) · 5.36 KB
/
skills.go
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
package skillz
import (
"context"
"time"
"github.com/volatiletech/null"
)
type CharacterSkillRepository interface {
memberAttributesRepository
memberSkillsRepository
memberSkillQueueRepository
memberFlyableShipRepository
}
type memberAttributesRepository interface {
CharacterAttributes(ctx context.Context, characterID uint64) (*CharacterAttributes, error)
CreateCharacterAttributes(ctx context.Context, attributes *CharacterAttributes) error
DeleteCharacterAttributes(ctx context.Context, characterID uint64) error
}
type memberSkillsRepository interface {
CharacterSkillMeta(ctx context.Context, characterID uint64) (*CharacterSkillMeta, error)
CreateCharacterSkillMeta(ctx context.Context, meta *CharacterSkillMeta) error
DeleteCharacterSkillMeta(ctx context.Context, characterID uint64) error
CharacterSkills(ctx context.Context, characterID uint64) ([]*CharacterSkill, error)
CreateCharacterSkills(ctx context.Context, skills []*CharacterSkill) error
DeleteCharacterSkills(ctx context.Context, characterID uint64) error
}
type memberSkillQueueRepository interface {
CharacterSkillQueue(ctx context.Context, characterID uint64) ([]*CharacterSkillQueue, error)
CreateCharacterSkillQueue(ctx context.Context, positions []*CharacterSkillQueue) error
DeleteCharacterSkillQueue(ctx context.Context, characterID uint64) error
}
type memberFlyableShipRepository interface {
CharacterFlyableShips(ctx context.Context, characterID uint64) ([]*CharacterFlyableShip, error)
CreateCharacterFlyableShips(ctx context.Context, ships []*CharacterFlyableShip) error
DeleteCharacterFlyableShips(ctx context.Context, characterID uint64) error
}
type CharacterAttributes struct {
CharacterID uint64 `db:"character_id" json:"character_id"`
Charisma uint `db:"charisma" json:"charisma"`
Intelligence uint `db:"intelligence" json:"intelligence"`
Memory uint `db:"memory" json:"memory"`
Perception uint `db:"perception" json:"perception"`
Willpower uint `db:"willpower" json:"willpower"`
BonusRemaps null.Uint `db:"bonus_remaps,omitempty" json:"bonus_remaps,omitempty"`
LastRemapDate null.Time `db:"last_remap_date,omitempty" json:"last_remap_date,omitempty"`
AccruedRemapCooldownDate null.Time `db:"accrued_remap_cooldown_date,omitempty" json:"accrued_remap_cooldown_date,omitempty"`
CreatedAt time.Time `db:"created_at" json:"-" deep:"-"`
UpdatedAt time.Time `db:"updated_at" json:"-" deep:"-"`
}
type CharacterSkillQueueSummary struct {
Summary []*QueueGroupSummary `json:"summary"`
Queue []*CharacterSkillQueue `json:"queue"`
}
type QueueGroupSummary struct {
Group *Group `json:"group"`
Count uint `json:"count"`
Skillpoints uint `json:"skillpoints"`
Duration time.Duration `json:"duration"`
}
type CharacterSkillQueue struct {
CharacterID uint64 `db:"character_id" json:"character_id" deep:"-"`
QueuePosition uint `db:"queue_position" json:"queue_position"`
SkillID uint `db:"skill_id" json:"skill_id"`
FinishedLevel uint `db:"finished_level" json:"finished_level"`
TrainingStartSp null.Uint `db:"training_start_sp,omitempty" json:"training_start_sp,omitempty"`
LevelStartSp null.Uint `db:"level_start_sp,omitempty" json:"level_start_sp,omitempty"`
LevelEndSp null.Uint `db:"level_end_sp,omitempty" json:"level_end_sp,omitempty"`
StartDate null.Time `db:"start_date,omitempty" json:"start_date,omitempty"`
FinishDate null.Time `db:"finish_date,omitempty" json:"finish_date,omitempty"`
CreatedAt time.Time `db:"created_at" json:"-" deep:"-"`
Type *Type `json:"info"`
}
type CharacterSkillMeta struct {
CharacterID uint64 `db:"character_id" json:"character_id"`
TotalSP uint `db:"total_sp" json:"total_sp"`
UnallocatedSP null.Uint `db:"unallocated_sp,omitempty" json:"unallocated_sp,omitempty"`
CreatedAt time.Time `db:"created_at" json:"-"`
UpdatedAt time.Time `db:"updated_at" json:"-"`
Skills []*CharacterSkill `json:"skills,omitempty"`
}
type CharacterSkill struct {
CharacterID uint64 `db:"character_id" json:"character_id"`
ActiveSkillLevel uint `db:"active_skill_level" json:"active_skill_level"`
SkillID uint `db:"skill_id" json:"skill_id"`
SkillpointsInSkill uint `db:"skillpoints_in_skill" json:"skillpoints_in_skill"`
TrainedSkillLevel uint `db:"trained_skill_level" json:"trained_skill_level"`
CreatedAt time.Time `db:"created_at" json:"-"`
UpdatedAt time.Time `db:"updated_at" json:"-"`
Info *Type `json:"type,omitempty"`
}
type CharacterSkillGroup struct {
*SkillGroup
TotalGroupSP uint `json:"totalGroupSP"`
}
type SkillGroup struct {
*Group
Skills []*SkillType `json:"skills"`
}
type SkillType struct {
*Type
Skill *CharacterSkill `json:"skill"`
Rank *TypeDogmaAttribute `json:"rank"`
}
// CharacterFlyableShip is a model of the database table
type CharacterFlyableShip struct {
CharacterID uint64 `db:"character_id" json:"character_id"`
ShipTypeID uint `db:"ship_type_id" json:"ship_type_id"`
CreatedAt time.Time `db:"created_at" json:"-"`
}
// ShipGroup is what is used on the frontend to render the Flyable Ships view
type ShipGroup struct {
*Group
Ships []*ShipType
}
type ShipType struct {
*Type
Flyable bool
}