Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Commit

Permalink
updates for rarity and skill info
Browse files Browse the repository at this point in the history
  • Loading branch information
kushieda-minori committed Dec 5, 2020
1 parent b4d2d87 commit 46e1217
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 7 deletions.
13 changes: 12 additions & 1 deletion handler/skillhandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ func SkillCsvHandler(w http.ResponseWriter, r *http.Request) {
"CondParam",
"DefaultRatio",
"MaxRatio",
"Cost",
"ChainFrontSkills",
"PublicStartDatetime",
"PublicEndDatetime",
"EffectID",
Expand All @@ -59,16 +61,22 @@ func SkillCsvHandler(w http.ResponseWriter, r *http.Request) {
"TargetParam",
"AnimationID",
"ThorHammerAnimationType",
"ReceiptItemID",
})
for _, s := range vc.Data.Skills {
var startDate, endDate string
var startDate, endDate, skillChain string
chainIds := make([]string, 0)
if s.PublicStartDatetime.IsZero() {
startDate = "-1"
endDate = "-1"
} else {
startDate = s.PublicStartDatetime.Format(time.RFC3339)
endDate = s.PublicEndDatetime.Format(time.RFC3339)
}
for _, scid := range s.ChainFrontSkillIDs {
chainIds = append(chainIds, strconv.Itoa(scid))
}
skillChain = strings.Join(chainIds, ", ")
err := cw.Write([]string{strconv.Itoa(s.ID),
s.Name,
s.Description,
Expand All @@ -88,6 +96,8 @@ func SkillCsvHandler(w http.ResponseWriter, r *http.Request) {
strconv.Itoa(s.CondParam),
strconv.Itoa(s.DefaultRatio),
strconv.Itoa(s.MaxRatio),
strconv.Itoa(s.Cost),
skillChain,
startDate,
endDate,
strconv.Itoa(s.EffectID),
Expand All @@ -105,6 +115,7 @@ func SkillCsvHandler(w http.ResponseWriter, r *http.Request) {
strconv.Itoa(s.TargetParam),
strconv.Itoa(s.AnimationID),
strings.ReplaceAll(string(s.ThorHammerAnimationType[:]), "\"", ""),
strconv.Itoa(s.ReceiptItemID),
})
if err != nil {
log.Printf(err.Error() + "\n")
Expand Down
2 changes: 1 addition & 1 deletion vc/card.go
Original file line number Diff line number Diff line change
Expand Up @@ -1314,4 +1314,4 @@ var EvoOrder = [10]string{"0", "1", "2", "3", "H", "A", "G", "GA", "X", "XA"}
var Elements = [5]string{"Light", "Passion", "Cool", "Dark", "Special"}

// Rarity of the cards
var Rarity = [17]string{"N", "R", "SR", "HN", "HR", "HSR", "X", "UR", "HUR", "GSR", "GUR", "LR", "HLR", "GLR", "XSR", "XUR", "XLR"}
var Rarity = []string{}
47 changes: 43 additions & 4 deletions vc/skill.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,24 @@ type Skill struct {
// animation info
AnimationID int `json:"animation_id"`
ThorHammerAnimationType json.RawMessage `json:"thorhammer_animation_type"`
// Custom Skill info
//Cost Custom Skill Cost
Cost int `json:"skill_cost"`
//ReceiptItemID ID Of the Custom Skill Item that builds this skill
ReceiptItemID int `json:"receipt_item_id"`
// For complex skills, this is the list of skills that are chained.
// i.e. Awoken Burst + DMG
ChainFrontSkillIDs []int `json:"chain_front_skills"`

Name string `json:"name"` //skill name from strings file
Description string `json:"description"` // description from strings file
Fire string `json:"fire"` // fire text from strings file
_skillLevels []SkillLevel
// v8.0 skill changes
// TBD

// post processed items
Name string `json:"name"` //skill name from strings file
Description string `json:"description"` // description from strings file
Fire string `json:"fire"` // fire text from strings file
_skillLevels []SkillLevel
_chainFrontSkills []Skill
}

// SkillLevel information
Expand All @@ -73,6 +86,32 @@ type SkillCostIncrementPattern struct {
Max int `json:"max"`
}

//ChainFrontSkills Gets the Chain Front Skills
func (s *Skill) ChainFrontSkills() []Skill {
if s == nil {
return make([]Skill, 0)
}

if s._chainFrontSkills == nil {
s._chainFrontSkills = make([]Skill, 0)
for _, cfsid := range s.ChainFrontSkillIDs {
sl := SkillScan(cfsid)
if sl != nil {
s._chainFrontSkills = append(s._chainFrontSkills, *sl)
}
}
}
return s._chainFrontSkills
}

//ReceiptItem Receipt Item
func (s *Skill) ReceiptItem() *Item {
if s == nil {
return nil
}
return ItemScan(s.ReceiptItemID)
}

// Expires true if the skill has an expiration date
func (s *Skill) Expires() bool {
if s == nil {
Expand Down
8 changes: 7 additions & 1 deletion vc/vcfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ type VFile struct {
Version int `json:"version"`
URLSchemes []URLScheme `json:"url_scheme"`
Cards CardList `json:"cards"`
CardRarities []CardRarity `json:"card_rares"`
Skills []Skill `json:"skills"`
SkillLevels []SkillLevel `json:"skill_level"`
CustomSkillLevels []CustomSkillLevel `json:"custom_skill_level"`
Expand All @@ -212,7 +213,6 @@ type VFile struct {
Rebirths []CardAwaken `json:"card_super_awaken"`
CardCharacters []CardCharacter `json:"card_character"`
FollowerKinds []FollowerKind `json:"follower_kinds"`
CardRarities []CardRarity `json:"card_rares"`
CardSpecialComposes []CardSpecialCompose `json:"card_special_compose"`
Levels []Level `json:"levels"`
LevelupBonuses []LevelupBonus `json:"levelup_bonus"`
Expand Down Expand Up @@ -316,6 +316,12 @@ func Read(root string) ([]byte, error) {
return nil, err
}

// get card rarities
Rarity = make([]string, 0)
for _, cr := range Data.CardRarities {
Rarity = append(Rarity, strings.ToUpper(cr.Signature))
}

strRoot := filepath.Join(root, "string")

// symbol names
Expand Down

0 comments on commit 46e1217

Please sign in to comment.