Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
cc6feb9dda
@ -409,6 +409,11 @@ const (
|
|||||||
Diamond int32 = 2 //钻石
|
Diamond int32 = 2 //钻石
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 排行算虚拟币最低值
|
||||||
|
const (
|
||||||
|
CaravanMerchantmoney int32 = 10000
|
||||||
|
)
|
||||||
|
|
||||||
// 定时通知类型
|
// 定时通知类型
|
||||||
type NotifyType int32
|
type NotifyType int32
|
||||||
|
|
||||||
@ -839,15 +844,16 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
PrivilegeType1 = iota + 1 //每日获得
|
PrivilegeType1 = iota + 1 //每日获得
|
||||||
PrivilegeType2 //金币商店每日免费刷新次数
|
PrivilegeType2 //金币商店每日免费刷新次数
|
||||||
PrivilegeType3 //维京远征每日可购买挑战次数
|
PrivilegeType3 //维京远征每日可购买挑战次数
|
||||||
PrivilegeType4 //狩猎每日可购买挑战次数
|
PrivilegeType4 //狩猎每日可购买挑战次数
|
||||||
PrivilegeType5 //竞技场每日可购买挑战次数
|
PrivilegeType5 //竞技场每日可购买挑战次数
|
||||||
PrivilegeType6 //梦境每日可购买挑战次数
|
PrivilegeType6 //梦境每日可购买挑战次数
|
||||||
PrivilegeType7 //巨怪商队背包容量
|
PrivilegeType7 //巨怪商队背包容量
|
||||||
PrivilegeType8 //美食馆每日最大制作时间
|
PrivilegeType8 //美食馆每日最大制作时间
|
||||||
PrivilegeType9 //武馆每日最大练功时间
|
PrivilegeType9 //武馆每日最大练功时间
|
||||||
|
PrivilegeType10 //竞技场门票存储上限
|
||||||
|
|
||||||
)
|
)
|
||||||
const (
|
const (
|
||||||
|
@ -421,8 +421,11 @@ func (this *modelArena) recoverTicket(session comm.IUserSession, info *pb.DBAren
|
|||||||
}
|
}
|
||||||
|
|
||||||
global := this.module.ModuleTools.GetGlobalConf()
|
global := this.module.ModuleTools.GetGlobalConf()
|
||||||
|
maxTick := global.ArenaTicketMax
|
||||||
|
// 竞技场最大上限
|
||||||
|
maxTick += this.module.privilege.GetCountByPrivilegeId(session.GetUserId(), comm.PrivilegeType10) // 特权
|
||||||
ticket = int32(this.module.ModuleItems.QueryItemAmount(info.Uid, ticketitem.T))
|
ticket = int32(this.module.ModuleItems.QueryItemAmount(info.Uid, ticketitem.T))
|
||||||
if ticket < global.ArenaTicketMax && info.Lastrtickettime > 0 {
|
if ticket < maxTick && info.Lastrtickettime > 0 {
|
||||||
duration = configure.Now().Sub(time.Unix(info.Lastrtickettime, 0))
|
duration = configure.Now().Sub(time.Unix(info.Lastrtickettime, 0))
|
||||||
ticketNum = int32(math.Floor(duration.Minutes() / float64(global.ArenaTicketRecoveryTime)))
|
ticketNum = int32(math.Floor(duration.Minutes() / float64(global.ArenaTicketRecoveryTime)))
|
||||||
if ticketNum > 0 {
|
if ticketNum > 0 {
|
||||||
|
@ -35,7 +35,7 @@ type Battle struct {
|
|||||||
clientmgr *battleClientMgrComp //c#战斗客户端端管理
|
clientmgr *battleClientMgrComp //c#战斗客户端端管理
|
||||||
}
|
}
|
||||||
|
|
||||||
//模块名
|
// 模块名
|
||||||
func (this *Battle) GetType() core.M_Modules {
|
func (this *Battle) GetType() core.M_Modules {
|
||||||
return comm.ModuleBattle
|
return comm.ModuleBattle
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ func (this *Battle) NewOptions() (options core.IModuleOptions) {
|
|||||||
return new(Options)
|
return new(Options)
|
||||||
}
|
}
|
||||||
|
|
||||||
//模块初始化接口 注册用户创建角色事件
|
// 模块初始化接口 注册用户创建角色事件
|
||||||
func (this *Battle) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
func (this *Battle) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||||
err = this.ModuleBase.Init(service, module, options)
|
err = this.ModuleBase.Init(service, module, options)
|
||||||
this.service = service.(base.IRPCXService)
|
this.service = service.(base.IRPCXService)
|
||||||
@ -71,7 +71,7 @@ func (this *Battle) Start() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//装备组件
|
// 装备组件
|
||||||
func (this *Battle) OnInstallComp() {
|
func (this *Battle) OnInstallComp() {
|
||||||
this.ModuleBase.OnInstallComp()
|
this.ModuleBase.OnInstallComp()
|
||||||
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
|
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||||
@ -80,7 +80,7 @@ func (this *Battle) OnInstallComp() {
|
|||||||
this.clientmgr = this.RegisterComp(new(battleClientMgrComp)).(*battleClientMgrComp)
|
this.clientmgr = this.RegisterComp(new(battleClientMgrComp)).(*battleClientMgrComp)
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询战斗记录
|
// 查询战斗记录
|
||||||
func (this *Battle) QueryBattleRecord(oid string) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
|
func (this *Battle) QueryBattleRecord(oid string) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
|
||||||
var err error
|
var err error
|
||||||
if record, err = this.modelBattle.queryrecord(oid); err != nil {
|
if record, err = this.modelBattle.queryrecord(oid); err != nil {
|
||||||
@ -93,7 +93,7 @@ func (this *Battle) QueryBattleRecord(oid string) (errdata *pb.ErrorData, record
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建pve战斗
|
// 创建pve战斗
|
||||||
func (this *Battle) CreateEveBattle(session comm.IUserSession, req *pb.BattleEVEReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
|
func (this *Battle) CreateEveBattle(session comm.IUserSession, req *pb.BattleEVEReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
|
||||||
var (
|
var (
|
||||||
conn *db.DBConn
|
conn *db.DBConn
|
||||||
@ -120,7 +120,7 @@ func (this *Battle) CreateEveBattle(session comm.IUserSession, req *pb.BattleEVE
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建pve战斗
|
// 创建pve战斗
|
||||||
func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVEReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
|
func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVEReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
|
||||||
var (
|
var (
|
||||||
conn *db.DBConn
|
conn *db.DBConn
|
||||||
@ -153,8 +153,10 @@ func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVE
|
|||||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var flag bool
|
||||||
for _, v := range req.Format.Friendformat {
|
for _, v := range req.Format.Friendformat {
|
||||||
if v != "" {
|
if v != "" {
|
||||||
|
flag = true
|
||||||
// this.ModuleBuried.SendToRtask(session, comm.Rtype108, 1)
|
// this.ModuleBuried.SendToRtask(session, comm.Rtype108, 1)
|
||||||
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype108, 1))
|
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype108, 1))
|
||||||
break
|
break
|
||||||
@ -164,13 +166,13 @@ func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVE
|
|||||||
if record, errdata = this.modelBattle.createpve(session, conn, pb.BattleType_pve, req); errdata != nil {
|
if record, errdata = this.modelBattle.createpve(session, conn, pb.BattleType_pve, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if req.Format.Friendformat != nil {
|
if flag {
|
||||||
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype12, 1))
|
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype12, 1))
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建pve战斗
|
// 创建pve战斗
|
||||||
func (this *Battle) CreatePvbBattle(session comm.IUserSession, req *pb.BattlePVBReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
|
func (this *Battle) CreatePvbBattle(session comm.IUserSession, req *pb.BattlePVBReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
|
||||||
var (
|
var (
|
||||||
conn *db.DBConn
|
conn *db.DBConn
|
||||||
@ -203,7 +205,7 @@ func (this *Battle) CreatePvbBattle(session comm.IUserSession, req *pb.BattlePVB
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建pve战斗
|
// 创建pve战斗
|
||||||
func (this *Battle) CreatePvpBattle(session comm.IUserSession, req *pb.BattlePVPReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
|
func (this *Battle) CreatePvpBattle(session comm.IUserSession, req *pb.BattlePVPReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
|
||||||
var (
|
var (
|
||||||
conn *db.DBConn
|
conn *db.DBConn
|
||||||
@ -229,7 +231,7 @@ func (this *Battle) CreatePvpBattle(session comm.IUserSession, req *pb.BattlePVP
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//只有跨服环境下才可使用
|
// 只有跨服环境下才可使用
|
||||||
func (this *Battle) CreateRtPvpBattle(req *pb.BattleRTPVPReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
|
func (this *Battle) CreateRtPvpBattle(req *pb.BattleRTPVPReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
|
||||||
var (
|
var (
|
||||||
redmodel *db.DBModel
|
redmodel *db.DBModel
|
||||||
@ -265,7 +267,7 @@ func (this *Battle) CreateRtPvpBattle(req *pb.BattleRTPVPReq) (errdata *pb.Error
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建连续战斗
|
// 创建连续战斗
|
||||||
func (this *Battle) CreateLPVEBattle(session comm.IUserSession, req *pb.BattleLPVEReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
|
func (this *Battle) CreateLPVEBattle(session comm.IUserSession, req *pb.BattleLPVEReq) (errdata *pb.ErrorData, record *pb.DBBattleRecord) {
|
||||||
var (
|
var (
|
||||||
conn *db.DBConn
|
conn *db.DBConn
|
||||||
@ -298,8 +300,10 @@ func (this *Battle) CreateLPVEBattle(session comm.IUserSession, req *pb.BattleLP
|
|||||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var flag bool
|
||||||
for _, v := range req.Format.Friendformat {
|
for _, v := range req.Format.Friendformat {
|
||||||
if v != "" {
|
if v != "" {
|
||||||
|
flag = true
|
||||||
// this.ModuleBuried.SendToRtask(session, comm.Rtype108, 1)
|
// this.ModuleBuried.SendToRtask(session, comm.Rtype108, 1)
|
||||||
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype108, 1))
|
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype108, 1))
|
||||||
break
|
break
|
||||||
@ -309,19 +313,19 @@ func (this *Battle) CreateLPVEBattle(session comm.IUserSession, req *pb.BattleLP
|
|||||||
if record, errdata = this.modelBattle.createlpve(session, conn, pb.BattleType_lpev, req); errdata != nil {
|
if record, errdata = this.modelBattle.createlpve(session, conn, pb.BattleType_lpev, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if req.Format.Friendformat != nil {
|
if flag {
|
||||||
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype12, 1))
|
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype12, 1))
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
///创建角色列表 更具Format表格
|
// /创建角色列表 更具Format表格
|
||||||
func (this *Battle) CreateRolesByFormat(fid int32) (captain int32, roles []*pb.BattleRole, errdata *pb.ErrorData) {
|
func (this *Battle) CreateRolesByFormat(fid int32) (captain int32, roles []*pb.BattleRole, errdata *pb.ErrorData) {
|
||||||
captain, roles, errdata = this.modelBattle.createMasterRoles(2, 0, fid)
|
captain, roles, errdata = this.modelBattle.createMasterRoles(2, 0, fid)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
///创建角色列表 更具英雄列表
|
// /创建角色列表 更具英雄列表
|
||||||
func (this *Battle) CreateRolesByHeros(heros []*pb.DBHero) (roles []*pb.BattleRole, errdata *pb.ErrorData) {
|
func (this *Battle) CreateRolesByHeros(heros []*pb.DBHero) (roles []*pb.BattleRole, errdata *pb.ErrorData) {
|
||||||
roles = make([]*pb.BattleRole, len(heros))
|
roles = make([]*pb.BattleRole, len(heros))
|
||||||
for i, v := range heros {
|
for i, v := range heros {
|
||||||
@ -334,7 +338,7 @@ func (this *Battle) CreateRolesByHeros(heros []*pb.DBHero) (roles []*pb.BattleRo
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
///获取战斗详情
|
// /获取战斗详情
|
||||||
func (this *Battle) GetBattleInfo(req *pb.BattleGetInfoReq) (errdata *pb.ErrorData, resp *pb.BattleGetInfoResp) {
|
func (this *Battle) GetBattleInfo(req *pb.BattleGetInfoReq) (errdata *pb.ErrorData, resp *pb.BattleGetInfoResp) {
|
||||||
this.Debug("GetBattleInfo", log.Field{Key: "req", Value: req})
|
this.Debug("GetBattleInfo", log.Field{Key: "req", Value: req})
|
||||||
var (
|
var (
|
||||||
@ -352,7 +356,7 @@ func (this *Battle) GetBattleInfo(req *pb.BattleGetInfoReq) (errdata *pb.ErrorDa
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建战斗服务
|
// 创建战斗服务
|
||||||
func (this *Battle) CreateBattleServer(req *pb.BattleInfo) (errdata *pb.ErrorData) {
|
func (this *Battle) CreateBattleServer(req *pb.BattleInfo) (errdata *pb.ErrorData) {
|
||||||
this.Debug("CreateBattleServer", log.Field{Key: "req", Value: req})
|
this.Debug("CreateBattleServer", log.Field{Key: "req", Value: req})
|
||||||
var (
|
var (
|
||||||
@ -400,7 +404,7 @@ func (this *Battle) InCmdBattle(req *pb.BattleInCmdReq) (errdata *pb.ErrorData)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//pvp认输
|
// pvp认输
|
||||||
func (this *Battle) ConcedeBattle(req *pb.BattleConcedeReq) (errdata *pb.ErrorData) {
|
func (this *Battle) ConcedeBattle(req *pb.BattleConcedeReq) (errdata *pb.ErrorData) {
|
||||||
var (
|
var (
|
||||||
resp *pb.BattleConcedeResp
|
resp *pb.BattleConcedeResp
|
||||||
@ -422,7 +426,7 @@ func (this *Battle) ConcedeBattle(req *pb.BattleConcedeReq) (errdata *pb.ErrorDa
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//校验战报是否成功
|
// 校验战报是否成功
|
||||||
func (this *Battle) CheckBattleReport(session comm.IUserSession, report *pb.BattleReport) (errdata *pb.ErrorData, iswin bool) {
|
func (this *Battle) CheckBattleReport(session comm.IUserSession, report *pb.BattleReport) (errdata *pb.ErrorData, iswin bool) {
|
||||||
var (
|
var (
|
||||||
reply *pb.BattleCheckResults
|
reply *pb.BattleCheckResults
|
||||||
|
@ -378,7 +378,7 @@ func (this *Caravan) Rpc_ModuleCaravanSettlement(ctx context.Context, args *pb.E
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 发送虚拟币奖励
|
// 发送虚拟币奖励
|
||||||
if _data, err := this.modelCaravan.DB.Find(comm.TableUser, bson.M{"merchantmoney": bson.M{"$gt": 0}}); err == nil {
|
if _data, err := this.modelCaravan.DB.Find(comm.TableUser, bson.M{"merchantmoney": bson.M{"$gt": comm.CaravanMerchantmoney}}); err == nil {
|
||||||
for _data.Next(context.TODO()) {
|
for _data.Next(context.TODO()) {
|
||||||
temp := &pb.DBUser{}
|
temp := &pb.DBUser{}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
)
|
)
|
||||||
|
|
||||||
//参数校验
|
// 参数校验
|
||||||
func (this *apiComp) LoginCheck(session comm.IUserSession, req *pb.UserLoginReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) LoginCheck(session comm.IUserSession, req *pb.UserLoginReq) (errdata *pb.ErrorData) {
|
||||||
if req.Account == "" {
|
if req.Account == "" {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
@ -21,7 +21,7 @@ func (this *apiComp) LoginCheck(session comm.IUserSession, req *pb.UserLoginReq)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//登录
|
// 登录
|
||||||
func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (errdata *pb.ErrorData) {
|
||||||
if errdata = this.LoginCheck(session, req); errdata != nil {
|
if errdata = this.LoginCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
@ -129,6 +129,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (err
|
|||||||
if this.module.modelUser.isLoginFirst(lastLoginTime) {
|
if this.module.modelUser.isLoginFirst(lastLoginTime) {
|
||||||
this.module.ModuleHero.NoLoginDay(user.Uid, int32(utils.DiffDays(lastLoginTime, configure.Now().Unix())))
|
this.module.ModuleHero.NoLoginDay(user.Uid, int32(utils.DiffDays(lastLoginTime, configure.Now().Unix())))
|
||||||
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype8, 1))
|
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype8, 1))
|
||||||
|
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype9, 1))
|
||||||
this.module.modelExpand.updateLoginDay(user.Uid, lastLoginTime)
|
this.module.modelExpand.updateLoginDay(user.Uid, lastLoginTime)
|
||||||
// 清理点赞
|
// 清理点赞
|
||||||
this.module.ModuleFriend.ResetFriend(user.Uid)
|
this.module.ModuleFriend.ResetFriend(user.Uid)
|
||||||
@ -150,7 +151,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (err
|
|||||||
} else {
|
} else {
|
||||||
rsp.Ex = expand
|
rsp.Ex = expand
|
||||||
}
|
}
|
||||||
} else { //新号
|
} else { //新号
|
||||||
rsp.Ex = &pb.DBUserExpand{}
|
rsp.Ex = &pb.DBUserExpand{}
|
||||||
this.module.modelSign.UserSign(session)
|
this.module.modelSign.UserSign(session)
|
||||||
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype8, 1))
|
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype8, 1))
|
||||||
|
@ -536,10 +536,12 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
change.Ps += add
|
change.Ps += add
|
||||||
if change.Ps > ggd.PsUl {
|
} else {
|
||||||
|
if change.Ps+add > ggd.PsUl {
|
||||||
change.Ps = ggd.PsUl
|
change.Ps = ggd.PsUl
|
||||||
|
} else {
|
||||||
|
change.Ps += add
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user