This commit is contained in:
meixiongfeng 2023-03-30 15:25:25 +08:00
commit 88fb474863
6 changed files with 201 additions and 123 deletions

View File

@ -10,7 +10,10 @@
"heroid": "13002",
"img": "sbkp_js_13002",
"ico": "",
"intr": "食人鱼",
"intr": {
"key": "shirenyu",
"text": "作为教习,食人鱼一直秉承着严厉的教习态度,在他手下训练的英雄可以获得巨大提升"
},
"description": {
"key": "wuguanshirenyu",
"text": "提升每分钟的经验值获取{0}%"
@ -33,7 +36,10 @@
"heroid": "13001",
"img": "sbkp_js_13001",
"ico": "",
"intr": "闪闪",
"intr": {
"key": "shanshan",
"text": "闪闪"
},
"description": {
"key": "wuguanshanshan",
"text": "提升每分钟的经验值获取{0}%"
@ -56,7 +62,10 @@
"heroid": "44002",
"img": "sbkp_js_44002",
"ico": "",
"intr": "蛇先生",
"intr": {
"key": "shexiansheng",
"text": "蛇先生"
},
"description": {
"key": "wuguanshexiansheng",
"text": "提升每分钟的经验值获取{0}%"
@ -79,7 +88,10 @@
"heroid": "24005",
"img": "sbkp_js_24005",
"ico": "",
"intr": "金猴",
"intr": {
"key": "jinhou",
"text": "金猴"
},
"description": {
"key": "wuguanjinhou",
"text": "提升每分钟的经验值获取{0}%,提升低级觉醒材料的获取数量{0}"
@ -113,7 +125,10 @@
"heroid": "14005",
"img": "sbkp_js_14005",
"ico": "",
"intr": "鹤大师",
"intr": {
"key": "hedashi",
"text": "鹤大师"
},
"description": {
"key": "wuguanhedashi",
"text": "提升可挂机的时间{0}秒"
@ -136,7 +151,10 @@
"heroid": "44006",
"img": "sbkp_js_44006",
"ico": "",
"intr": "悍娇虎",
"intr": {
"key": "hanjiaohu",
"text": "悍娇虎"
},
"description": {
"key": "wuguanhanjiaohu",
"text": "提升可挂机的时间{0}秒"
@ -159,7 +177,10 @@
"heroid": "43001",
"img": "sbkp_js_43001",
"ico": "",
"intr": "盖",
"intr": {
"key": "gai",
"text": "盖"
},
"description": {
"key": "wuguangai",
"text": "提升可挂机的时间{0}秒"
@ -182,7 +203,10 @@
"heroid": "35002",
"img": "sbkp_js_35002",
"ico": "",
"intr": "希卡普",
"intr": {
"key": "xikapu",
"text": "希卡普"
},
"description": {
"key": "wuguanxikapu",
"text": "提升可挂机的时间{0}秒,提升每分钟的经验值获取{0}%"
@ -205,7 +229,10 @@
"heroid": "45004",
"img": "sbkp_js_45004",
"ico": "",
"intr": "穿靴猫",
"intr": {
"key": "mao",
"text": "穿靴猫"
},
"description": {
"key": "wuguanmao",
"text": "提升低级觉醒材料的获取数量{0}"
@ -239,7 +266,10 @@
"heroid": "35001",
"img": "sbkp_js_35001",
"ico": "",
"intr": "师父",
"intr": {
"key": "shifu",
"text": "师父"
},
"description": {
"key": "wuguanshifu",
"text": "提升低级觉醒材料的获取数量{0}"
@ -273,7 +303,10 @@
"heroid": "25001",
"img": "sbkp_js_25001",
"ico": "",
"intr": "阿宝",
"intr": {
"key": "abao",
"text": "阿宝"
},
"description": {
"key": "wuguanabao",
"text": "{0}%概率获得1个3级升星精灵"
@ -307,7 +340,10 @@
"heroid": "45001",
"img": "sbkp_js_45001",
"ico": "",
"intr": "乌龟大师",
"intr": {
"key": "wuguidashi",
"text": "乌龟大师"
},
"description": {
"key": "wuguanwuguidashi",
"text": "{0}%概率获得1个3级升星精灵"
@ -341,7 +377,10 @@
"heroid": "",
"img": "wg_icon_ss",
"ico": "",
"intr": "石锁",
"intr": {
"key": "shisuo",
"text": "石锁,传闻是师父在训练阿宝时经常使用到的道具"
},
"description": {
"key": "wuguanshisuo",
"text": "提升每分钟的经验值获取{0}%,提升低级觉醒材料的获取数量{0}"
@ -375,7 +414,10 @@
"heroid": "",
"img": "wg_icon_kz",
"ico": "",
"intr": "双头空竹",
"intr": {
"key": "kongzu",
"text": "双头空竹"
},
"description": {
"key": "wuguankongzu",
"text": "提升每分钟的经验值获取{0}%"
@ -398,7 +440,10 @@
"heroid": "",
"img": "wg_icon_pj",
"ico": "",
"intr": "木爬架",
"intr": {
"key": "mupajia",
"text": "木爬架"
},
"description": {
"key": "wuguanmupajia",
"text": "提升每分钟的经验值获取{0}%"
@ -421,7 +466,10 @@
"heroid": "",
"img": "wg_icon_bdw",
"ico": "",
"intr": "不倒翁",
"intr": {
"key": "budaoweng",
"text": "不倒翁"
},
"description": {
"key": "wuguanbudaoweng",
"text": "提升每分钟的经验值获取{0}%"
@ -444,7 +492,10 @@
"heroid": "",
"img": "wg_icon_pc",
"ico": "",
"intr": "棒槌",
"intr": {
"key": "bangchui",
"text": "棒槌"
},
"description": {
"key": "wuguanbangchui",
"text": "提升可挂机的时间{0}秒"
@ -467,7 +518,10 @@
"heroid": "",
"img": "wg_icon_tl",
"ico": "",
"intr": "铜铃",
"intr": {
"key": "tongling",
"text": "铜铃"
},
"description": {
"key": "wuguantongling",
"text": "提升可挂机的时间{0}秒"
@ -490,7 +544,10 @@
"heroid": "",
"img": "wg_icon_tj",
"ico": "",
"intr": "尖刺吊环",
"intr": {
"key": "diaohuan",
"text": "尖刺吊环"
},
"description": {
"key": "wuguandiaohuan",
"text": "提升可挂机的时间{0}秒"
@ -513,7 +570,10 @@
"heroid": "",
"img": "wg_icon_tj01",
"ico": "",
"intr": "陀螺",
"intr": {
"key": "tuoluo",
"text": "陀螺"
},
"description": {
"key": "wuguantuoluo",
"text": "提升可挂机的时间{0}秒,提升每分钟的经验值获取{0}%"
@ -536,7 +596,10 @@
"heroid": "",
"img": "wg_icon_zl",
"ico": "",
"intr": "大转轮",
"intr": {
"key": "dazhuanlun",
"text": "大转轮"
},
"description": {
"key": "wuguandazhuanlun",
"text": "提升低级觉醒材料的获取数量{0}"
@ -570,7 +633,10 @@
"heroid": "",
"img": "wg_icon_mp",
"ico": "",
"intr": "木头牌",
"intr": {
"key": "mutoupai",
"text": "木头牌"
},
"description": {
"key": "wuguanmutoupai",
"text": "提升低级觉醒材料的获取数量{0}"
@ -604,7 +670,10 @@
"heroid": "",
"img": "wg_icon_sjg",
"ico": "",
"intr": "双节棍",
"intr": {
"key": "shuangjiegun",
"text": "双节棍"
},
"description": {
"key": "wuguanshuangjiegun",
"text": "{0}%概率获得1个3级升星精灵"
@ -638,7 +707,10 @@
"heroid": "",
"img": "wg_icon_yd",
"ico": "",
"intr": "练功带",
"intr": {
"key": "liangongdai",
"text": "练功带"
},
"description": {
"key": "wuguanliangongdai",
"text": "{0}%概率获得1个3级升星精灵"
@ -672,7 +744,10 @@
"heroid": "",
"img": "wg_icon_tj",
"ico": "",
"intr": "七彩花棍",
"intr": {
"key": "qicaihuagun",
"text": "七彩花棍"
},
"description": {
"key": "wuguanqicaihuagun",
"text": "{0}%概率获得1个3级升星精灵"
@ -706,7 +781,10 @@
"heroid": "",
"img": "wg_icon_fb",
"ico": "",
"intr": "流星飞镖",
"intr": {
"key": "liuxingfeibiao",
"text": "流星飞镖"
},
"description": {
"key": "wuguanliuxingfeibiao",
"text": "提升可挂机的时间{0}秒"
@ -729,7 +807,10 @@
"heroid": "",
"img": "wg_icon_mxl",
"ico": "",
"intr": "冥想锣",
"intr": {
"key": "mingxiangluo",
"text": "冥想锣"
},
"description": {
"key": "wuguanmingxiangluo",
"text": "提升可挂机的时间{0}秒"
@ -752,7 +833,10 @@
"heroid": "",
"img": "wg_icon_ct",
"ico": "",
"intr": "彩条龙",
"intr": {
"key": "caitiaolong",
"text": "彩条龙"
},
"description": {
"key": "wuguancaitiaolong",
"text": "提升可挂机的时间{0}秒,提升每分钟的经验值获取{0}%"
@ -775,7 +859,10 @@
"heroid": "",
"img": "wg_icon_kqms",
"ico": "",
"intr": "孔雀毛扇",
"intr": {
"key": "kongquemaosan",
"text": "孔雀毛扇"
},
"description": {
"key": "wuguankongquemaosan",
"text": "提升低级觉醒材料的获取数量{0}"
@ -807,7 +894,10 @@
"heroid": "",
"img": "wg_icon_ph",
"ico": "",
"intr": "平衡木",
"intr": {
"key": "pinghengmu",
"text": "平衡木"
},
"description": {
"key": "wuguanpinghengmu",
"text": "提升低级觉醒材料的获取数量{0}"
@ -839,7 +929,10 @@
"heroid": "",
"img": "wg_icon_th",
"ico": "",
"intr": "铁环",
"intr": {
"key": "tiehuan",
"text": "铁环"
},
"description": {
"key": "wuguantiehuan",
"text": "{0}%概率获得1个3级升星精灵"
@ -871,7 +964,10 @@
"heroid": "",
"img": "wg_icon_tj",
"ico": "",
"intr": "太极球",
"intr": {
"key": "taijiqiu",
"text": "太极球"
},
"description": {
"key": "wuguantaijiqiu",
"text": "{0}%概率获得1个3级升星精灵,提升低级觉醒材料的获取数量{0}"

View File

@ -63,7 +63,7 @@ func (a *apiComp) Refresh(session comm.IUserSession, req *pb.DispatchRefreshReq)
return
}
a.module.Debug("刷新", log.Field{Key: "taskIds", Value: taskIds})
// a.module.Debug("刷新", log.Field{Key: "taskIds", Value: taskIds})
//更新公告任务
if err := a.module.modelDispatch.updateTasks(session.GetUserId(), d.Nb, taskIds); err != nil {
a.module.Debug("更新公告失败", log.Field{Key: "uid", Value: session.GetUserId()})

View File

@ -79,7 +79,7 @@ func (this *modelDispatch) getDBDispatch(uid string) (dis *pb.DBDispatch) {
}
// 获取随机任务ID
func (this *modelDispatch) getTasksWeight(uid string, d *pb.DBDispatch) int32 {
func (this *modelDispatch) getTasksWeight(d *pb.DBDispatch) int32 {
if d == nil {
return 0
}
@ -120,40 +120,9 @@ func (this *modelDispatch) taskRandom(uid string, dispatch *pb.DBDispatch) (task
var n int
n = len(dispatch.Nb.Tasks)
var existIds []int32
for _, v := range dispatch.Nb.Tasks {
existIds = append(existIds, v.TaskId)
}
if n == 0 {
//随机6个任务
total := 0
for total < 6 {
tId := this.getTasksWeight(uid, dispatch)
if tId == 0 {
return
}
//去重
if _, ok := utils.Findx(existIds, int32(tId)); !ok {
existIds = append(existIds, int32(tId))
total++
}
}
for _, id := range existIds {
taskConf, err := this.module.configure.getDispatchTaskConf(int32(id))
if err != nil {
continue
}
//公告持续截至时间
duration := configure.Now().Unix() + int64(taskConf.Taskcd)
tasks = append(tasks, &pb.DispatchTask{
TaskId: int32(id),
Duration: duration,
})
}
//随机任务
tasks = this.randomTask(dispatch, NOTICE_NUM)
} else {
var randCount int
for i := 0; i < len(dispatch.Nb.Tasks); i++ {
@ -166,97 +135,107 @@ func (this *modelDispatch) taskRandom(uid string, dispatch *pb.DBDispatch) (task
}
}
//追加随机
tasks = append(tasks, this.addRandomTask(uid, dispatch, randCount)...)
tasks = append(tasks, this.addRandomTask(dispatch, randCount)...)
}
return
}
func (this *modelDispatch) addRandomTask(uid string, dispatch *pb.DBDispatch, n int) (tasks []*pb.DispatchTask) {
func (this *modelDispatch) randomTask(dispatch *pb.DBDispatch, n int) (tasks []*pb.DispatchTask) {
total := 0
for total < n {
rid := this.getTasksWeight(dispatch)
if rid == 0 {
return nil
}
if len(dispatch.Nb.Tasks) == 0 {
dispatch.Nb.Tasks = append(dispatch.Nb.Tasks, &pb.DispatchTask{
TaskId: rid,
})
total++
} else {
//去重
exist := false
for _, v := range dispatch.Nb.Tasks {
if v.TaskId == rid {
exist = true
}
}
if !exist {
dispatch.Nb.Tasks = append(dispatch.Nb.Tasks, &pb.DispatchTask{
TaskId: rid,
})
total++
}
}
}
//更新任务持续截至时间
for _, task := range dispatch.Nb.Tasks {
taskConf, err := this.module.configure.getDispatchTaskConf(task.TaskId)
if err != nil {
return nil
}
if task.Duration == 0 {
duration := configure.Now().Unix() + int64(taskConf.Taskcd)
task.Duration = duration
}
tasks = append(tasks, task)
}
return
}
func (this *modelDispatch) addRandomTask(dispatch *pb.DBDispatch, n int) (tasks []*pb.DispatchTask) {
if n <= 0 {
tasks = dispatch.Nb.Tasks
return
}
var existIds []int32
for _, v := range dispatch.Nb.Tasks {
existIds = append(existIds, v.TaskId)
}
total := 0
for total < n {
rid := this.getTasksWeight(uid, dispatch)
if rid == 0 {
return nil
}
//去重
if _, ok := utils.Findx(existIds, int32(rid)); !ok {
existIds = append(existIds, int32(rid))
total++
}
}
for _, id := range existIds {
taskConf, err := this.module.configure.getDispatchTaskConf(int32(id))
if err != nil {
return nil
}
//公告持续截至时间
duration := configure.Now().Unix() + int64(taskConf.Taskcd)
dt := &pb.DispatchTask{
TaskId: int32(id),
Duration: duration,
}
tasks = append(tasks, dt)
}
return
return this.randomTask(dispatch, n)
}
// 替换指定的已完成任务
func (this *modelDispatch) replaceTask(uid string, taskId int32, dispatch *pb.DBDispatch) (tasks []*pb.DispatchTask, oldTask *pb.DispatchTask) {
tasks = dispatch.Nb.Tasks
var randCount int
for i := 0; i < len(tasks); i++ {
for i := 0; i < len(dispatch.Nb.Tasks); i++ {
//替换状态是完成的任务
if tasks[i].Status == 2 {
if taskId != tasks[i].TaskId {
if dispatch.Nb.Tasks[i].Status == 2 {
if taskId != dispatch.Nb.Tasks[i].TaskId {
continue
}
oldTask = tasks[i]
oldTask = dispatch.Nb.Tasks[i]
//删除
tasks = append(tasks[:i], tasks[i+1:]...)
dispatch.Nb.Tasks = append(dispatch.Nb.Tasks[:i], dispatch.Nb.Tasks[i+1:]...)
i--
randCount++
break
}
}
tasks = append(tasks, this.addRandomTask(uid, dispatch, randCount)...)
tasks = append(tasks, this.addRandomTask(dispatch, randCount)...)
return
}
// 替换所有完成的任务
func (this *modelDispatch) replaceFinishedTask(uid string, dispatch *pb.DBDispatch) (tasks []*pb.DispatchTask, oldtasks []*pb.DispatchTask) {
var randCount int
tmp := dispatch.Nb.Tasks
for i := 0; i < len(tmp); i++ {
for i := 0; i < len(dispatch.Nb.Tasks); i++ {
//替换状态是完成的任务
if tmp[i].Status == 2 {
if dispatch.Nb.Tasks[i].Status == 2 {
//删除
oldtasks = append(oldtasks, tmp[i])
oldtasks = append(oldtasks, dispatch.Nb.Tasks[i])
dispatch.Nb.Tasks = append(dispatch.Nb.Tasks[:i], dispatch.Nb.Tasks[i+1:]...)
i--
randCount++
} else {
tasks = append(tasks, tmp[i])
tasks = append(tasks, dispatch.Nb.Tasks[i])
}
}
tasks = append(tasks, this.addRandomTask(uid, dispatch, randCount)...)
tasks = append(tasks, this.addRandomTask(dispatch, randCount)...)
return
}
@ -420,9 +399,9 @@ func (this *modelDispatch) updateNotice(uid string, dispatch *pb.DBDispatch) err
//刷新任务
count := len(dispatch.Nb.Tasks)
if count < 6 {
randCount = 6 - count
dispatch.Nb.Tasks = append(dispatch.Nb.Tasks, this.addRandomTask(uid, dispatch, randCount)...)
if count < NOTICE_NUM {
randCount = NOTICE_NUM - count
dispatch.Nb.Tasks = append(dispatch.Nb.Tasks, this.addRandomTask(dispatch, randCount)...)
}
//判断是否有下一等级

View File

@ -6,6 +6,9 @@ import (
"go_dreamfactory/modules"
)
// 默认6条公告数量
const NOTICE_NUM int = 6
// 派遣
type Dispatch struct {
modules.ModuleBase

View File

@ -186,7 +186,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
comm.Rtype26, comm.Rtype27, comm.Rtype28, comm.Rtype38,
comm.Rtype39, comm.Rtype50, comm.Rtype51, comm.Rtype53,
comm.Rtype54, comm.Rtype57, comm.Rtype58, comm.Rtype60,
comm.Rtype62, comm.Rtype64, comm.Rtype69, comm.Rtype72, comm.Rtype88, comm.Rtype104,
comm.Rtype62, comm.Rtype64, comm.Rtype69, comm.Rtype72, comm.Rtype73, comm.Rtype88, comm.Rtype104,
comm.Rtype96, comm.Rtype105, comm.Rtype128, comm.Rtype130, comm.Rtype131,
comm.Rtype141, comm.Rtype142, comm.Rtype143, comm.Rtype144, comm.Rtype145, comm.Rtype146,
comm.Rtype147, comm.Rtype149, comm.Rtype153, comm.Rtype154, comm.Rtype155, comm.Rtype156:

View File

@ -48,7 +48,7 @@ func (_v *GamePandamasJxData)Deserialize(_buf map[string]interface{}) (err error
{ var _ok_ bool; if _v.Heroid, _ok_ = _buf["heroid"].(string); !_ok_ { err = errors.New("heroid error"); return } }
{ var _ok_ bool; if _v.Img, _ok_ = _buf["img"].(string); !_ok_ { err = errors.New("img error"); return } }
{ var _ok_ bool; if _v.Ico, _ok_ = _buf["ico"].(string); !_ok_ { err = errors.New("ico error"); return } }
{ var _ok_ bool; if _v.Intr, _ok_ = _buf["intr"].(string); !_ok_ { err = errors.New("intr error"); return } }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["intr"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Intr error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Intr, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["description"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Description error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Description, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["duration"].(float64); !_ok_ { err = errors.New("duration error"); return }; _v.Duration = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["exp"].(float64); !_ok_ { err = errors.New("exp error"); return }; _v.Exp = int32(_tempNum_) }