This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package coolconfig
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
@@ -72,7 +74,7 @@ type file struct {
|
||||
func newConfig() *sConfig {
|
||||
var ctx g.Ctx
|
||||
config := &sConfig{
|
||||
AutoMigrate: GetCfgWithDefault(ctx, "blazing.autoMigrate", g.NewVar(false)).Bool(),
|
||||
AutoMigrate: hasDebugArg(),
|
||||
Name: GetCfgWithDefault(ctx, "server.name", g.NewVar("")).String(),
|
||||
|
||||
Eps: GetCfgWithDefault(ctx, "blazing.eps", g.NewVar(false)).Bool(),
|
||||
@@ -97,6 +99,19 @@ func newConfig() *sConfig {
|
||||
return config
|
||||
}
|
||||
|
||||
func hasDebugArg() bool {
|
||||
for _, arg := range os.Args[1:] {
|
||||
if arg == "-debug" || arg == "--debug" {
|
||||
return true
|
||||
}
|
||||
if strings.HasPrefix(arg, "-debug=") || strings.HasPrefix(arg, "--debug=") {
|
||||
value := strings.TrimSpace(strings.SplitN(arg, "=", 2)[1])
|
||||
return value != "" && value != "0" && !strings.EqualFold(value, "false")
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// qiniu 七牛云配置
|
||||
type qiniu struct {
|
||||
AccessKey string `json:"ak"`
|
||||
|
||||
@@ -63,7 +63,13 @@ func CreateTable(model IModel) error {
|
||||
autoMigrateMu.Lock()
|
||||
autoMigrateModels = append(autoMigrateModels, model)
|
||||
autoMigrateMu.Unlock()
|
||||
return nil
|
||||
|
||||
if !Config.AutoMigrate {
|
||||
return nil
|
||||
}
|
||||
|
||||
db := getDBbyModel(model)
|
||||
return db.AutoMigrate(model)
|
||||
}
|
||||
|
||||
// RunAutoMigrate 显式执行已注册模型的建表/迁移。
|
||||
|
||||
@@ -18,8 +18,8 @@ func (h Controller) GetPetBargeList(data *PetBargeListInboundInfo, player *playe
|
||||
ret.PetBargeList = append(ret.PetBargeList, pet.PetBargeListInfo{
|
||||
PetId: uint32(v.Args[0]),
|
||||
EnCntCnt: 1,
|
||||
IsCatched: uint32(v.Results[0]),
|
||||
IsKilled: uint32(v.Results[1]),
|
||||
IsCatched: uint32(v.Results[1]),
|
||||
IsKilled: uint32(v.Results[0]),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -106,6 +106,9 @@ func (h Controller) GetAllFurniture(data *FitmentAllInboundEmpty, c *player.Play
|
||||
// 返回: 精灵详细信息和错误码
|
||||
func (h Controller) GetRoomPetInfo(data *C2S_RoomPetInfo, c *player.Player) (result *pet.RoomPetInfo, err errorcode.ErrorCode) {
|
||||
petInfo := c.Service.Pet.PetInfoOneOther(data.UserID, data.CatchTime)
|
||||
if petInfo == nil {
|
||||
return nil, errorcode.ErrorCodes.ErrPokemonNotExists
|
||||
}
|
||||
result = &pet.RoomPetInfo{}
|
||||
copier.CopyWithOption(result, &petInfo.Data, copier.Option{DeepCopy: true})
|
||||
result.OwnerId = data.UserID
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
_ "blazing/logic/service/fight/itemover"
|
||||
_ "blazing/logic/service/fight/rule"
|
||||
"blazing/modules/player/model"
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
@@ -69,15 +68,12 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, skill *info
|
||||
//还原属性
|
||||
attacker.Prop, defender.Prop = originalProps[0], originalProps[1]
|
||||
attackerPet.Info, defenderPet.Info = originalPetInfo[0], originalPetInfo[1]
|
||||
fmt.Printf("[processSkillAttack] After restore: attacker.Prop=%v, defender.Prop=%v\n", attacker.Prop, defender.Prop)
|
||||
|
||||
if attacker.IsCritical == 1 { //命中了才有暴击
|
||||
//暴击破防
|
||||
if skill.Category() == info.Category.PHYSICAL && defender.Prop[1] > 0 {
|
||||
fmt.Printf("[processSkillAttack] Crit break DEF: defender.Prop[1] %d -> 0\n", defender.Prop[1])
|
||||
defender.Prop[1] = 0
|
||||
} else if skill.Category() == info.Category.SPECIAL && defender.Prop[3] > 0 {
|
||||
fmt.Printf("[processSkillAttack] Crit break SPDEF: defender.Prop[3] %d -> 0\n", defender.Prop[3])
|
||||
defender.Prop[3] = 0
|
||||
}
|
||||
//暴击翻倍
|
||||
@@ -105,7 +101,6 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, skill *info
|
||||
effect.OnSkill() //调用伤害计算
|
||||
return true
|
||||
})
|
||||
fmt.Printf("[processSkillAttack] After OnSkill: attacker.Prop=%v, defender.Prop=%v, attacker.SkillID=%d\n", attacker.Prop, defender.Prop, attacker.SkillID)
|
||||
|
||||
defender.Damage(attacker, &info.DamageZone{
|
||||
Damage: SumDamage,
|
||||
@@ -443,7 +438,6 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
return true
|
||||
})
|
||||
}
|
||||
fmt.Printf("[enterturn] After Skill_Use: attacker.Prop=%v, defender.Prop=%v\n", attacker.Prop, defender.Prop)
|
||||
//技能使用后
|
||||
defender.ExecWithOpponent(attacker, func(effect input.Effect) bool { //技能使用后的我方效果
|
||||
f.setEffectSkillContext(effect, currentSkill, defender)
|
||||
@@ -456,7 +450,6 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
effect.Action_end()
|
||||
return true
|
||||
})
|
||||
fmt.Printf("[enterturn] After Action_end: attacker.Prop=%v, defender.Prop=%v\n", attacker.Prop, defender.Prop)
|
||||
|
||||
if defenderPet != nil && attackerPet != nil && defenderPet.Info.Hp <= 0 && attackerPet.Info.Hp <= 0 { //先手方死亡,触发反同归于尽
|
||||
attackerPet.Info.Hp = 1
|
||||
@@ -495,7 +488,6 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
}
|
||||
|
||||
attackValueResult := f.buildNoteUseSkillOutboundInfo()
|
||||
fmt.Printf("[enterturn] Broadcast: First.Prop=%v, Second.Prop=%v\n", attackValueResult.FirstAttackInfo.Prop, attackValueResult.SecondAttackInfo.Prop)
|
||||
//因为切完才能广播,所以必须和回合结束分开结算
|
||||
f.BroadcastPlayers(func(p common.PlayerI) {
|
||||
for _, switchAction := range f.Switch {
|
||||
@@ -566,3 +558,4 @@ func (f *FightC) TURNOVER(cur *input.Input) {
|
||||
// break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,64 +21,7 @@ type TimeBossRule struct {
|
||||
}
|
||||
|
||||
// Timed boss schedule config.
|
||||
var timeBossRules = []TimeBossRule{
|
||||
{
|
||||
PetID: 261,
|
||||
Week: 1,
|
||||
ShowHours: []int{12, 17, 18, 24},
|
||||
ShowMinute: 35,
|
||||
LastTime: 40,
|
||||
MapIDs: []uint32{15, 105, 54},
|
||||
},
|
||||
{
|
||||
PetID: 261,
|
||||
Week: 2,
|
||||
ShowHours: []int{17, 18, 24},
|
||||
ShowMinute: 0,
|
||||
LastTime: 5,
|
||||
MapIDs: []uint32{15, 105, 54},
|
||||
},
|
||||
{
|
||||
PetID: 261,
|
||||
Week: 3,
|
||||
ShowHours: []int{17, 18, 24},
|
||||
ShowMinute: 0,
|
||||
LastTime: 5,
|
||||
MapIDs: []uint32{15, 105, 54},
|
||||
},
|
||||
{
|
||||
PetID: 261,
|
||||
Week: 4,
|
||||
ShowHours: []int{12, 17, 18, 24},
|
||||
ShowMinute: 35,
|
||||
LastTime: 40,
|
||||
MapIDs: []uint32{15, 105, 54},
|
||||
},
|
||||
{
|
||||
PetID: 261,
|
||||
Week: 5,
|
||||
ShowHours: []int{17, 18, 24},
|
||||
ShowMinute: 0,
|
||||
LastTime: 5,
|
||||
MapIDs: []uint32{15, 105, 54},
|
||||
},
|
||||
{
|
||||
PetID: 261,
|
||||
Week: 6,
|
||||
ShowHours: []int{17, 18, 24},
|
||||
ShowMinute: 0,
|
||||
LastTime: 5,
|
||||
MapIDs: []uint32{15, 105, 54},
|
||||
},
|
||||
{
|
||||
PetID: 261,
|
||||
Week: 7,
|
||||
ShowHours: generateHourRange(0, 23),
|
||||
ShowMinute: 0,
|
||||
LastTime: 10,
|
||||
MapIDs: []uint32{15, 105, 54},
|
||||
},
|
||||
}
|
||||
var timeBossRules = []TimeBossRule{}
|
||||
|
||||
var (
|
||||
registeredCronIDs = make(map[string]bool)
|
||||
|
||||
@@ -29,6 +29,7 @@ var (
|
||||
g.DB().SetDebug(true)
|
||||
// service.NewServerService().SetServerScreen(0, "sss")
|
||||
cool.Config.ServerInfo.IsDebug = 1
|
||||
cool.Config.AutoMigrate = true
|
||||
}
|
||||
if err = cool.RunAutoMigrate(); err != nil {
|
||||
return err
|
||||
|
||||
@@ -56,7 +56,6 @@ redis:
|
||||
pass: "redis_TxYnSy"
|
||||
|
||||
blazing:
|
||||
autoMigrate: true
|
||||
eps: true
|
||||
file:
|
||||
mode: "local" # local | minio | oss
|
||||
|
||||
20
modules/config/controller/admin/collect_plan.go
Normal file
20
modules/config/controller/admin/collect_plan.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/config/service"
|
||||
)
|
||||
|
||||
type CollectPlanController struct {
|
||||
*cool.Controller
|
||||
}
|
||||
|
||||
func init() {
|
||||
cool.RegisterController(&CollectPlanController{
|
||||
&cool.Controller{
|
||||
Prefix: "/admin/config/collectPlan",
|
||||
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
|
||||
Service: service.NewCollectPlanService(),
|
||||
},
|
||||
})
|
||||
}
|
||||
35
modules/config/model/collect_plan.go
Normal file
35
modules/config/model/collect_plan.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package model
|
||||
|
||||
import "blazing/cool"
|
||||
|
||||
const (
|
||||
TableNameCollectPlanConfig = "config_collect_plan"
|
||||
)
|
||||
|
||||
// CollectPlanConfig 精灵收集计划配置。
|
||||
type CollectPlanConfig struct {
|
||||
*BaseConfig
|
||||
|
||||
Title string `gorm:"type:varchar(64);not null;default:'';comment:'计划标题'" json:"title" description:"计划标题"`
|
||||
Description string `gorm:"type:text;not null;default:'';comment:'计划描述'" json:"description" description:"计划描述"`
|
||||
RewardGroups []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'奖励精灵组'" json:"reward_groups" description:"奖励精灵组"`
|
||||
TargetGroups []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'目标精灵列表'" json:"target_groups" description:"目标精灵列表"`
|
||||
}
|
||||
|
||||
func (*CollectPlanConfig) TableName() string {
|
||||
return TableNameCollectPlanConfig
|
||||
}
|
||||
|
||||
func (*CollectPlanConfig) GroupName() string {
|
||||
return "default"
|
||||
}
|
||||
|
||||
func NewCollectPlanConfig() *CollectPlanConfig {
|
||||
return &CollectPlanConfig{
|
||||
BaseConfig: NewBaseConfig(),
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
cool.CreateTable(&CollectPlanConfig{})
|
||||
}
|
||||
36
modules/config/service/collect_plan.go
Normal file
36
modules/config/service/collect_plan.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/config/model"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type CollectPlanService struct {
|
||||
*cool.Service
|
||||
}
|
||||
|
||||
func NewCollectPlanService() *CollectPlanService {
|
||||
return &CollectPlanService{
|
||||
&cool.Service{
|
||||
Model: model.NewCollectPlanConfig(),
|
||||
ListQueryOp: &cool.QueryOp{
|
||||
FieldEQ: []string{"is_enable", "id"},
|
||||
AddOrderby: map[string]string{
|
||||
"id": "asc",
|
||||
},
|
||||
},
|
||||
PageQueryOp: &cool.QueryOp{
|
||||
FieldEQ: []string{"is_enable", "id"},
|
||||
KeyWordField: []string{"title", "description", "remark"},
|
||||
AddOrderby: map[string]string{
|
||||
"id": "asc",
|
||||
},
|
||||
ModifyResult: func(ctx g.Ctx, data interface{}) interface{} {
|
||||
return data
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -260,10 +260,16 @@ func (s *PetService) PetInfoOneByID(id uint32) *model.Pet {
|
||||
return tt
|
||||
}
|
||||
|
||||
func (s *PetService) PetInfoOneOther(userid, catchTime uint32) model.Pet {
|
||||
var tt model.Pet
|
||||
s.dbm(s.Model).Where("catch_time", catchTime).Scan(&tt)
|
||||
tt.Data.CatchTime = tt.CatchTime
|
||||
func (s *PetService) PetInfoOneOther(userid, catchTime uint32) *model.Pet {
|
||||
var tt *model.Pet
|
||||
if err := s.dbm_fix(s.Model).
|
||||
Where("player_id", userid).
|
||||
Where("catch_time", catchTime).
|
||||
Where("is_vip", cool.Config.ServerInfo.IsVip).
|
||||
Scan(&tt); err != nil || tt == nil {
|
||||
return nil
|
||||
}
|
||||
setCatchTime(tt)
|
||||
return tt
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user