This commit is contained in:
wh_zcy 2023-03-23 12:02:11 +08:00
parent 755693518a
commit 21800d3fd9
5 changed files with 38 additions and 28 deletions

View File

@ -567,18 +567,22 @@
"t": "gold", "t": "gold",
"n": 1000 "n": 1000
}, },
"dispatch_Refreshtimes": 6, "dispatch_Refreshtimes": 100,
"dispatch_numoftimes": 6, "dispatch_numoftimes": 60,
"dispatch_numtools": 10012, "dispatch_numtools": {
"a": "item",
"t": "10012",
"n": 1
},
"dispatch_npctimes": 2, "dispatch_npctimes": 2,
"dispatch_weektaskreward": [ "dispatch_weektaskreward": [
{ {
"n": 4, "n": 4,
"g": [ "g": [
{ {
"a": "attr", "a": "item",
"t": "gold", "t": "10006",
"n": 9999 "n": 1
}, },
{ {
"a": "attr", "a": "attr",
@ -591,9 +595,9 @@
"n": 8, "n": 8,
"g": [ "g": [
{ {
"a": "attr", "a": "item",
"t": "gold", "t": "10006",
"n": 99 "n": 2
}, },
{ {
"a": "attr", "a": "attr",
@ -606,9 +610,9 @@
"n": 10, "n": 10,
"g": [ "g": [
{ {
"a": "attr", "a": "item",
"t": "gold", "t": "10006",
"n": 500 "n": 4
} }
] ]
} }

View File

@ -4,6 +4,7 @@ import (
"errors" "errors"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
) )
@ -53,7 +54,8 @@ func (a *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.
} }
//校验门票 //校验门票
if d.Ticket <= 0 { ticketAtn := a.module.configure.GetGlobalConf().DispatchNumtools
if code = a.module.CheckRes(session, []*cfg.Gameatn{ticketAtn}); code != pb.ErrorCode_Success {
code = pb.ErrorCode_DispatchTicketNoEnough code = pb.ErrorCode_DispatchTicketNoEnough
return return
} }
@ -70,6 +72,9 @@ func (a *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.
return return
} }
//扣除门票
a.module.ConsumeRes(session, []*cfg.Gameatn{ticketAtn}, true)
rsp.IsSucc = true rsp.IsSucc = true
session.SendMsg(string(a.module.GetType()), "do", rsp) session.SendMsg(string(a.module.GetType()), "do", rsp)
return return

View File

@ -4,6 +4,7 @@ import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"go_dreamfactory/sys/configure" "go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
"go_dreamfactory/utils" "go_dreamfactory/utils"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
@ -35,8 +36,6 @@ func (a *apiComp) Notice(session comm.IUserSession, req *pb.DispatchNoticeReq) (
} }
freeCount := a.module.configure.GetGlobalConf().DispatchFreecheck freeCount := a.module.configure.GetGlobalConf().DispatchFreecheck
ticketCount := a.module.configure.GetGlobalConf().DispatchNumoftimes
nb := &pb.Noticeboard{ nb := &pb.Noticeboard{
Lv: 1, //公告初始升级 Lv: 1, //公告初始升级
FreeCount: freeCount, FreeCount: freeCount,
@ -46,15 +45,25 @@ func (a *apiComp) Notice(session comm.IUserSession, req *pb.DispatchNoticeReq) (
update := map[string]interface{}{ update := map[string]interface{}{
"nb": nb, "nb": nb,
"ticket": ticketCount,
} }
if err := a.module.modelDispatch.Change(uid, update); err != nil { if err := a.module.modelDispatch.Change(uid, update); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return
} }
d.Nb = nb d.Nb = nb
rsp.Ticket = ticketCount
} else { } else {
//恢复门票
one := utils.DiffDays(d.Nb.UpdateTime, configure.Now().Unix())
if one >= 1 {
itemId := a.module.configure.GetGlobalConf().DispatchNumtools.T
left := a.module.ModuleItems.QueryItemAmount(uid, itemId)
limit := a.module.configure.GetGlobalConf().DispatchNumoftimes
if int32(left) < limit {
add := limit - int32(left)
atn := &cfg.Gameatn{A: "item", T: itemId, N: add}
a.module.DispenseRes(session, []*cfg.Gameatn{atn}, true)
}
}
//周任务重置 //周任务重置
n := utils.DiffDays(d.Nb.UpdateTime, configure.Now().Unix()) n := utils.DiffDays(d.Nb.UpdateTime, configure.Now().Unix())
day := a.module.configure.GetGlobalConf().DispatchWeektaskcheck day := a.module.configure.GetGlobalConf().DispatchWeektaskcheck
@ -63,13 +72,6 @@ func (a *apiComp) Notice(session comm.IUserSession, req *pb.DispatchNoticeReq) (
d.Nb.WeekReceived = []int32{} d.Nb.WeekReceived = []int32{}
d.Nb.UpdateTime = configure.Now().Unix() d.Nb.UpdateTime = configure.Now().Unix()
} }
one := utils.DiffDays(d.Nb.UpdateTime, configure.Now().Unix())
if one >= 1 {
d.Ticket = a.module.configure.GetGlobalConf().DispatchNumoftimes
}
rsp.Ticket = d.Ticket
a.module.modelDispatch.updateNotice(session.GetUserId(), d) a.module.modelDispatch.updateNotice(session.GetUserId(), d)
} }

View File

@ -363,7 +363,6 @@ func (this *modelDispatch) dispatch(uid string, taskId int32, heroIds []string,
update := map[string]interface{}{ update := map[string]interface{}{
"nb": disp.Nb, "nb": disp.Nb,
"ticket": disp.Ticket - 1,
} }
if err := this.Change(uid, update); err != nil { if err := this.Change(uid, update); err != nil {
return err return err

View File

@ -185,7 +185,7 @@ type GameGlobalData struct {
DispatchCheckmoney *Gameatn DispatchCheckmoney *Gameatn
DispatchRefreshtimes int32 DispatchRefreshtimes int32
DispatchNumoftimes int32 DispatchNumoftimes int32
DispatchNumtools int32 DispatchNumtools *Gameatn
DispatchNpctimes int32 DispatchNpctimes int32
DispatchWeektaskreward []*Gamedispatch DispatchWeektaskreward []*Gamedispatch
DispatchWeektaskcheck int32 DispatchWeektaskcheck int32
@ -781,7 +781,7 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["dispatch_checkmoney"].(map[string]interface{}); !_ok_ { err = errors.New("dispatch_checkmoney error"); return }; if _v.DispatchCheckmoney, err = DeserializeGameatn(_x_); err != nil { return } } { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["dispatch_checkmoney"].(map[string]interface{}); !_ok_ { err = errors.New("dispatch_checkmoney error"); return }; if _v.DispatchCheckmoney, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dispatch_Refreshtimes"].(float64); !_ok_ { err = errors.New("dispatch_Refreshtimes error"); return }; _v.DispatchRefreshtimes = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dispatch_Refreshtimes"].(float64); !_ok_ { err = errors.New("dispatch_Refreshtimes error"); return }; _v.DispatchRefreshtimes = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dispatch_numoftimes"].(float64); !_ok_ { err = errors.New("dispatch_numoftimes error"); return }; _v.DispatchNumoftimes = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dispatch_numoftimes"].(float64); !_ok_ { err = errors.New("dispatch_numoftimes error"); return }; _v.DispatchNumoftimes = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dispatch_numtools"].(float64); !_ok_ { err = errors.New("dispatch_numtools error"); return }; _v.DispatchNumtools = int32(_tempNum_) } { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["dispatch_numtools"].(map[string]interface{}); !_ok_ { err = errors.New("dispatch_numtools error"); return }; if _v.DispatchNumtools, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dispatch_npctimes"].(float64); !_ok_ { err = errors.New("dispatch_npctimes error"); return }; _v.DispatchNpctimes = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dispatch_npctimes"].(float64); !_ok_ { err = errors.New("dispatch_npctimes error"); return }; _v.DispatchNpctimes = int32(_tempNum_) }
{ {
var _arr_ []interface{} var _arr_ []interface{}