This commit is contained in:
@@ -20,6 +20,25 @@ const (
|
|||||||
colorMax = 0xFFFFFF // 颜色值最大值(0xRRGGBB)
|
colorMax = 0xFFFFFF // 颜色值最大值(0xRRGGBB)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// GlowFilterDefault 默认值:与目标JSON完全匹配的常量
|
||||||
|
var GlowFilterDefault = GlowFilter{
|
||||||
|
Color: 16777215, // 0xFFFFFF(对应JSON的color:16777215)
|
||||||
|
Alpha: 0.8, // 对应JSON的alpha:0.8
|
||||||
|
BlurX: 10, // 对应JSON的blurX:10
|
||||||
|
BlurY: 10, // 对应JSON的blurY:10
|
||||||
|
Strength: 8, // 对应JSON的strength:8
|
||||||
|
Quality: 2, // 对应JSON的quality:2
|
||||||
|
Inner: true, // 对应JSON的inner:true
|
||||||
|
Knockout: false, // 无JSON值,默认false
|
||||||
|
ColorMatrixFilter: [20]float32{1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0}, // 对应JSON的matrix数组
|
||||||
|
Level: 1, // 对应JSON的level:"1"(转uint8)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDef() GlowFilter {
|
||||||
|
return GlowFilterDefault
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// 精灵加shinylen字段
|
// 精灵加shinylen字段
|
||||||
// 3. 核心结构体:BlurX/BlurY/Strength 改为 uint8
|
// 3. 核心结构体:BlurX/BlurY/Strength 改为 uint8
|
||||||
type GlowFilter struct {
|
type GlowFilter struct {
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ import (
|
|||||||
blservice "blazing/modules/player/service"
|
blservice "blazing/modules/player/service"
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"blazing/modules/config/model"
|
|
||||||
|
|
||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
"github.com/gogf/gf/v2/util/gconv"
|
"github.com/gogf/gf/v2/util/gconv"
|
||||||
csmap "github.com/mhmtszr/concurrent-swiss-map"
|
csmap "github.com/mhmtszr/concurrent-swiss-map"
|
||||||
@@ -39,26 +37,26 @@ type OgrePetInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o *OgrePetInfo) FixSHiny() {
|
func (o *OgrePetInfo) FixSHiny() {
|
||||||
var co *model.ColorfulSkin
|
var co *data.GlowFilter
|
||||||
if o.Ext == 0 {
|
if o.Ext == 0 {
|
||||||
|
|
||||||
co = config.NewShinyService().RandShiny(o.ID)
|
co = config.NewShinyService().RandShiny(o.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
if co != nil && len(o.ShinyInfo) == 0 {
|
if co != nil && len(o.ShinyInfo) == 0 {
|
||||||
o.ShinyInfo = append(o.ShinyInfo, co.Color)
|
o.ShinyInfo = append(o.ShinyInfo, *co)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
func (o *OgrePetInfo) RandomByWeightShiny() {
|
func (o *OgrePetInfo) RandomByWeightShiny() {
|
||||||
var co *model.ColorfulSkin
|
var co *data.GlowFilter
|
||||||
if o.Ext == 0 {
|
if o.Ext == 0 {
|
||||||
|
|
||||||
co = config.NewShinyService().RandomByWeightShiny(o.ID)
|
co = config.NewShinyService().RandomByWeightShiny(o.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
if co != nil && len(o.ShinyInfo) == 0 {
|
if co != nil && len(o.ShinyInfo) == 0 {
|
||||||
o.ShinyInfo = append(o.ShinyInfo, co.Color)
|
o.ShinyInfo = append(o.ShinyInfo, *co)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ func (s *ShinyService) ModifyBefore(ctx context.Context, method string, param g.
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (s *ShinyService) RandShiny(id uint32) *model.ColorfulSkin {
|
func (s *ShinyService) RandShiny(id uint32) *data.GlowFilter {
|
||||||
|
|
||||||
var ret []model.ColorfulSkin
|
var ret []model.ColorfulSkin
|
||||||
|
|
||||||
@@ -64,19 +64,19 @@ func (s *ShinyService) RandShiny(id uint32) *model.ColorfulSkin {
|
|||||||
m.Increment("usage_count", 1)
|
m.Increment("usage_count", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &v
|
return &v.Color
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r := model.GenerateRandomOffspringMatrix()
|
r := model.GenerateRandomOffspringMatrix()
|
||||||
var t data.GlowFilter
|
var t = data.GetDef()
|
||||||
var ret1 model.ColorfulSkin
|
|
||||||
t.ColorMatrixFilter = r.Get()
|
t.ColorMatrixFilter = r.Get()
|
||||||
ret1.Color = t
|
|
||||||
return &ret1
|
return &t
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ShinyService) RandomByWeightShiny(id uint32) *model.ColorfulSkin {
|
func (s *ShinyService) RandomByWeightShiny(id uint32) *data.GlowFilter {
|
||||||
|
|
||||||
var ret []model.ColorfulSkin
|
var ret []model.ColorfulSkin
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ func (s *ShinyService) RandomByWeightShiny(id uint32) *model.ColorfulSkin {
|
|||||||
m.Increment("refresh_count", 1)
|
m.Increment("refresh_count", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &r
|
return &r.Color
|
||||||
|
|
||||||
}
|
}
|
||||||
func (s *ShinyService) GetShiny(id int) *data.GlowFilter {
|
func (s *ShinyService) GetShiny(id int) *data.GlowFilter {
|
||||||
|
|||||||
@@ -218,14 +218,14 @@ func (pet *PetInfo) Cure() {
|
|||||||
func (pet *PetInfo) FixShiny() {
|
func (pet *PetInfo) FixShiny() {
|
||||||
|
|
||||||
co := service.NewShinyService().RandShiny(pet.ID)
|
co := service.NewShinyService().RandShiny(pet.ID)
|
||||||
pet.ShinyInfo = append(pet.ShinyInfo, co.Color)
|
pet.ShinyInfo = append(pet.ShinyInfo, *co)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 比重融合
|
// 比重融合
|
||||||
func (pet *PetInfo) RandomByWeightShiny() {
|
func (pet *PetInfo) RandomByWeightShiny() {
|
||||||
|
|
||||||
co := service.NewShinyService().RandomByWeightShiny(pet.ID)
|
co := service.NewShinyService().RandomByWeightShiny(pet.ID)
|
||||||
pet.ShinyInfo = append(pet.ShinyInfo, co.Color)
|
pet.ShinyInfo = append(pet.ShinyInfo, *co)
|
||||||
|
|
||||||
}
|
}
|
||||||
func (pet *PetInfo) IsShiny() bool {
|
func (pet *PetInfo) IsShiny() bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user