Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
8fd90c6c37
@ -4,7 +4,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
@ -90,7 +89,7 @@ func (ss *SSHService) RunShell(shell string) {
|
|||||||
|
|
||||||
//获取session,这个session是用来远程执行操作的
|
//获取session,这个session是用来远程执行操作的
|
||||||
if session, err = ss.Client.NewSession(); err != nil {
|
if session, err = ss.Client.NewSession(); err != nil {
|
||||||
log.Fatalln("error occurred:", err)
|
logrus.Errorf("error newsession:%v", err)
|
||||||
}
|
}
|
||||||
// 使用 session.Shell() 模拟终端时,所建立的终端参数
|
// 使用 session.Shell() 模拟终端时,所建立的终端参数
|
||||||
modes := ssh.TerminalModes{
|
modes := ssh.TerminalModes{
|
||||||
@ -105,7 +104,7 @@ func (ss *SSHService) RunShell(shell string) {
|
|||||||
|
|
||||||
//执行shell
|
//执行shell
|
||||||
if output, err := session.CombinedOutput(shell); err != nil {
|
if output, err := session.CombinedOutput(shell); err != nil {
|
||||||
log.Fatalln("error occurred:", err)
|
logrus.Errorf("error CombinedOutput:%v", err)
|
||||||
} else {
|
} else {
|
||||||
ss.LastResult = string(output)
|
ss.LastResult = string(output)
|
||||||
}
|
}
|
||||||
|
@ -201,12 +201,75 @@ const (
|
|||||||
|
|
||||||
// 随机任务类型
|
// 随机任务类型
|
||||||
const (
|
const (
|
||||||
RtaskTypeHeroTarget TaskType = 1 //英雄指定
|
Rtype1 TaskType = 1 //英雄指定
|
||||||
RtaskTypePoltId TaskType = 2 //剧情ID
|
Rtype2 TaskType = 2 //主线之内触发了剧情Id
|
||||||
RtaskTypeTaskDay TaskType = 3 //每日任务
|
Rtype3 TaskType = 3 //每日任务
|
||||||
RtaskTypeHeroLvTarget TaskType = 4 //指定英雄的等级
|
Rtask4 TaskType = 4 //指定英雄的等级限制
|
||||||
RtaskTypeEquipNum TaskType = 5 //指定英雄的装备数量
|
Rtype5 TaskType = 5 //指定英雄的装备数量
|
||||||
RtaskTypeHeroStarTarget TaskType = 6 //指定英雄的星级
|
Rtype6 TaskType = 6 //指定英雄的星级
|
||||||
|
Rtype7 TaskType = 7 //日常登录一次
|
||||||
|
Rtype8 TaskType = 8 //累计登陆xx天
|
||||||
|
Rtype9 TaskType = 9 //连续登陆xx天
|
||||||
|
Rtype10 TaskType = 10 //拥有xx个好友
|
||||||
|
Rtype11 TaskType = 11 //赠送X次友情点
|
||||||
|
Rtask12 TaskType = 12 //使用好友助战英雄xx次
|
||||||
|
Rtask13 TaskType = 13 //更换X次助战英雄
|
||||||
|
Rtype14 TaskType = 14 //累计xx次普通招募
|
||||||
|
Rtype15 TaskType = 15 //累计xx次阵营招募
|
||||||
|
Rtype16 TaskType = 16 //招募获得xx品质英雄xx个
|
||||||
|
Rtype17 TaskType = 17 //普通招募十连,获得xx个以上xx星英雄
|
||||||
|
Rtype18 TaskType = 18 //xx次普通招募
|
||||||
|
Rtype19 TaskType = 19 //xx次阵营招募
|
||||||
|
Rtype20 TaskType = 20 //用户等级达到xx级
|
||||||
|
Rtype21 TaskType = 21 //英雄合成xx次
|
||||||
|
Rtype22 TaskType = 22 //合成xx英雄
|
||||||
|
Rtype23 TaskType = 23 //拥有xx个xx星级的xx等级英雄
|
||||||
|
Rtype24 TaskType = 24 //为任意英雄提升xx次等级
|
||||||
|
Rtype25 TaskType = 25 //xx名xx英雄升至xx星
|
||||||
|
Rtype26 TaskType = 26 //xx名英雄从三星升四星
|
||||||
|
Rtype27 TaskType = 27 //xx名英雄从四星升五星
|
||||||
|
Rtype28 TaskType = 28 //xx名英雄从五星升六星
|
||||||
|
Rtype29 TaskType = 29 //拥有xx个xx级及以上的【xx】英雄
|
||||||
|
Rtype30 TaskType = 30 //获得xx个品质为xx的英雄
|
||||||
|
Rtype31 TaskType = 31 //获得xx个品质为xx以上的英雄
|
||||||
|
Rtype32 TaskType = 32 //xx个品质为xx的英雄升到xx级
|
||||||
|
Rtype33 TaskType = 33 //xx个品质为xx以及以上英雄升到xx级
|
||||||
|
Rtype34 TaskType = 34 //xx个英雄觉醒达到xx阶段
|
||||||
|
Rtype35 TaskType = 35 //xx英雄觉醒达到xx阶段
|
||||||
|
Rtype36 TaskType = 36 //xx位xx品质xx职业英雄(xx阵营)觉醒达到xx阶段
|
||||||
|
Rtype37 TaskType = 37 //xx名xx品质英雄满共鸣、等级、觉醒
|
||||||
|
Rtype38 TaskType = 38 //xx英雄满级、共鸣、觉醒至最高状态
|
||||||
|
Rtype39 TaskType = 39 //累计英雄共鸣xx次
|
||||||
|
Rtype40 TaskType = 40 //xx个英雄共鸣满xx次
|
||||||
|
Rtype41 TaskType = 41 //xx名英雄穿戴xx件xx星级的装备
|
||||||
|
Rtype42 TaskType = 42 //xx名英雄穿戴xx件xx等级的装备
|
||||||
|
Rtype43 TaskType = 43 //将xx件装备强化至xx级
|
||||||
|
Rtype44 TaskType = 44 //任意装备强化到xx级
|
||||||
|
Rtype45 TaskType = 45 //将xx件xx星【xx】套装装备强化至xx级
|
||||||
|
Rtype46 TaskType = 46 //为xx名英雄穿戴完整xx星【xx】套装装备
|
||||||
|
Rtype47 TaskType = 47 //累计强化装备成功xx次
|
||||||
|
Rtype48 TaskType = 48 //xx次xx星的二件套装备强化至xx并穿戴
|
||||||
|
Rtype49 TaskType = 49 //xx次xx星的四件套装备强化至xx并穿戴
|
||||||
|
Rtype50 TaskType = 50 //获得xx星以上装备xx件
|
||||||
|
Rtype51 TaskType = 51 //在铁匠铺中获得xx件xx星装备
|
||||||
|
Rtype52 TaskType = 52 //xx英雄提升xx次技能等级
|
||||||
|
Rtype53 TaskType = 53 //技能升级累计xx次
|
||||||
|
Rtype54 TaskType = 54 //x名卡牌角色技能全满级
|
||||||
|
Rtype55 TaskType = 55 //xx品质英雄提升xx次技能等级
|
||||||
|
Rtype56 TaskType = 56 //拥有xx名技能升级xx次的xx职业英雄
|
||||||
|
Rtype57 TaskType = 57 //xx名英雄技能满级
|
||||||
|
Rtype58 TaskType = 58 //通关任意普通爬塔层数
|
||||||
|
Rtype59 TaskType = 59 //通关普通爬塔xx层
|
||||||
|
Rtype60 TaskType = 60 //任意主线副本通关1次
|
||||||
|
Rtype61 TaskType = 61 //通关主线关卡xx
|
||||||
|
Rtype62 TaskType = 62 //世界聊天发言xx次
|
||||||
|
Rtype63 TaskType = 63 //日常任务活跃度达到xx
|
||||||
|
Rtype64 TaskType = 64 //任意商品购买xx次
|
||||||
|
Rtype65 TaskType = 65 //在商店购买xx商品xx件
|
||||||
|
Rtype66 TaskType = 66 //xx商店购买任意商品xx次
|
||||||
|
Rtype67 TaskType = 67 //商店购物消耗xx货币xx个
|
||||||
|
Rtype68 TaskType = 68 //任意渠道消耗xx金币
|
||||||
|
Rtype69 TaskType = 69 //与其他玩家切磋xx次
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -113,7 +113,7 @@ type (
|
|||||||
// 随机任务
|
// 随机任务
|
||||||
IRtask interface {
|
IRtask interface {
|
||||||
//任务触发
|
//任务触发
|
||||||
SendToRtask(session IUserSession, param *pb.RtaskParam) (code pb.ErrorCode)
|
SendToRtask(session IUserSession, rtaskType int32, params ...int32) (code pb.ErrorCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
//好友
|
//好友
|
||||||
|
@ -2,9 +2,11 @@ package modules
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/core/cbase"
|
"go_dreamfactory/lego/core/cbase"
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"sync"
|
"sync"
|
||||||
@ -156,7 +158,55 @@ func (this *MCompConfigure) GetPlayerFigureConf() (list []*cfg.GameFacemodData)
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *MCompConfigure) GetDropData(dropId int32) (data []*cfg.GameDropData) {
|
func (this *MCompConfigure) GetDropData(dropId int32) (data []*cfg.GameDropData) {
|
||||||
data = this._dropMap[dropId]
|
data = this._dropMap[dropId]
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo 调用drop 表 获取掉落信息
|
||||||
|
func (this *MCompConfigure) GetMultipleDropReward(count, dropId int32, Items []*pb.UserAssets) {
|
||||||
|
res := make([]*cfg.Gameatn, 0)
|
||||||
|
for i := 0; i < int(count); i++ {
|
||||||
|
data := this.GetDropData(dropId)
|
||||||
|
szW := make([]int32, 0)
|
||||||
|
for _, value := range data {
|
||||||
|
szW = append(szW, value.P)
|
||||||
|
}
|
||||||
|
if len(szW) > 0 {
|
||||||
|
index := comm.GetRandW(szW)
|
||||||
|
res = append(res, data[index].Prize...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, v := range res {
|
||||||
|
bFind := false
|
||||||
|
for _, v1 := range Items {
|
||||||
|
if v.A == v1.A && v.T == v1.T {
|
||||||
|
v1.N += v.N
|
||||||
|
bFind = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !bFind {
|
||||||
|
Items = append(Items, &pb.UserAssets{
|
||||||
|
A: v.A,
|
||||||
|
T: v.T,
|
||||||
|
N: v.N,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
func (this *MCompConfigure) GetDropReward(dropId int32, Items []*cfg.Gameatn) {
|
||||||
|
Items = make([]*cfg.Gameatn, 0)
|
||||||
|
|
||||||
|
data := this.GetDropData(dropId)
|
||||||
|
szW := make([]int32, 0)
|
||||||
|
for _, value := range data {
|
||||||
|
szW = append(szW, value.P)
|
||||||
|
}
|
||||||
|
index := comm.GetRandW(szW)
|
||||||
|
Items = append(Items, data[index].Prize...)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"go_dreamfactory/lego/sys/redis"
|
"go_dreamfactory/lego/sys/redis"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
|
||||||
"go_dreamfactory/utils"
|
"go_dreamfactory/utils"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -65,40 +64,6 @@ func (this *modelGourmet) modifyGourmetDataByObjId(uid string, data map[string]i
|
|||||||
return this.Change(uid, data)
|
return this.Change(uid, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo 调用drop 表 获取掉落信息
|
|
||||||
func (this *modelGourmet) GetDropReward(count, dropId int32, Items []*pb.UserAssets) {
|
|
||||||
res := make([]*cfg.Gameatn, 0)
|
|
||||||
for i := 0; i < int(count); i++ {
|
|
||||||
data := this.module.configure.GetDropData(dropId)
|
|
||||||
szW := make([]int32, 0)
|
|
||||||
for _, value := range data {
|
|
||||||
szW = append(szW, value.P)
|
|
||||||
}
|
|
||||||
if len(szW) > 0 {
|
|
||||||
index := comm.GetRandW(szW)
|
|
||||||
res = append(res, data[index].Prize...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, v := range res {
|
|
||||||
bFind := false
|
|
||||||
for _, v1 := range Items {
|
|
||||||
if v.A == v1.A && v.T == v1.T {
|
|
||||||
v1.N += v.N
|
|
||||||
bFind = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !bFind {
|
|
||||||
Items = append(Items, &pb.UserAssets{
|
|
||||||
A: v.A,
|
|
||||||
T: v.T,
|
|
||||||
N: v.N,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 计算订单信息
|
// 计算订单信息
|
||||||
func (this *modelGourmet) CalculationGourmet(uid string, gourmet *pb.DBGourmet) {
|
func (this *modelGourmet) CalculationGourmet(uid string, gourmet *pb.DBGourmet) {
|
||||||
var (
|
var (
|
||||||
@ -140,7 +105,7 @@ func (this *modelGourmet) CalculationGourmet(uid string, gourmet *pb.DBGourmet)
|
|||||||
gourmet.OrderCostTime = 0 // 清空当天的订单时长
|
gourmet.OrderCostTime = 0 // 清空当天的订单时长
|
||||||
}
|
}
|
||||||
order.FoodCount--
|
order.FoodCount--
|
||||||
this.GetDropReward(_gourmetcfg.Using, _gourmetcfg.Propsgroup, gourmet.Items) // 获取掉落奖励
|
this.module.configure.GetMultipleDropReward(_gourmetcfg.Using, _gourmetcfg.Propsgroup, gourmet.Items) // 获取掉落奖励
|
||||||
|
|
||||||
if curTime > costTime {
|
if curTime > costTime {
|
||||||
gourmet.OrderCostTime += int32(curTime - costTime)
|
gourmet.OrderCostTime += int32(curTime - costTime)
|
||||||
|
@ -61,13 +61,13 @@ func (this *apiComp) Choose(session comm.IUserSession, req *pb.RtaskChooseReq) (
|
|||||||
frtaskArr = &pb.FrtaskIds{}
|
frtaskArr = &pb.FrtaskIds{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新完成的任务
|
|
||||||
//验证该任务是否已完成
|
//验证该任务是否已完成
|
||||||
if _, ok := utils.Findx(frtaskArr.RtaskIds, req.RtaskId); ok {
|
if _, ok := utils.Findx(frtaskArr.RtaskIds, req.RtaskId); ok {
|
||||||
code = pb.ErrorCode_RtaskFinished
|
code = pb.ErrorCode_RtaskFinished
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新完成的任务
|
||||||
frtaskArr.RtaskIds = append(frtaskArr.RtaskIds, req.RtaskId)
|
frtaskArr.RtaskIds = append(frtaskArr.RtaskIds, req.RtaskId)
|
||||||
if rtask.FrtaskIds == nil {
|
if rtask.FrtaskIds == nil {
|
||||||
rtask.FrtaskIds = make(map[int32]*pb.FrtaskIds)
|
rtask.FrtaskIds = make(map[int32]*pb.FrtaskIds)
|
||||||
@ -80,9 +80,6 @@ func (this *apiComp) Choose(session comm.IUserSession, req *pb.RtaskChooseReq) (
|
|||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
}
|
}
|
||||||
|
|
||||||
//发奖励
|
|
||||||
code = this.moduleRtask.DispenseRes(session, sideConf.Reward, true)
|
|
||||||
|
|
||||||
rsp := &pb.RtaskChooseResp{
|
rsp := &pb.RtaskChooseResp{
|
||||||
RtaskId: req.RtaskId,
|
RtaskId: req.RtaskId,
|
||||||
ChooseId: req.ChooseId,
|
ChooseId: req.ChooseId,
|
||||||
|
@ -81,6 +81,11 @@ func (this *ModelRtask) checkCondi(uid string, condiId int32) (ok bool) {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 任务记录
|
||||||
|
func (this *ModelRtask) record(uid string,rtypeId int32, val... int32) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// 英雄指定
|
// 英雄指定
|
||||||
func (this *ModelRtask) HeroTarget(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool) {
|
func (this *ModelRtask) HeroTarget(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool) {
|
||||||
heroModule, err := this.service.GetModule(comm.ModuleHero)
|
heroModule, err := this.service.GetModule(comm.ModuleHero)
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -72,35 +73,35 @@ func (this *ModuleRtask) initRtaskHandle() {
|
|||||||
if typeCfg, err := this.configure.getRtaskTypeById(v.Id); err == nil {
|
if typeCfg, err := this.configure.getRtaskTypeById(v.Id); err == nil {
|
||||||
if typeCfg != nil {
|
if typeCfg != nil {
|
||||||
switch comm.TaskType(typeCfg.Type) {
|
switch comm.TaskType(typeCfg.Type) {
|
||||||
case comm.RtaskTypeHeroTarget:
|
case comm.Rtype1:
|
||||||
this.register(v.Id, &rtaskCondi{
|
this.register(v.Id, &rtaskCondi{
|
||||||
cfg: typeCfg,
|
cfg: typeCfg,
|
||||||
fn: this.modelRtask.HeroTarget,
|
fn: this.modelRtask.HeroTarget,
|
||||||
})
|
})
|
||||||
case comm.RtaskTypeHeroLvTarget:
|
case comm.Rtask4:
|
||||||
this.register(v.Id, &rtaskCondi{
|
this.register(v.Id, &rtaskCondi{
|
||||||
cfg: typeCfg,
|
cfg: typeCfg,
|
||||||
fn: this.modelRtask.HeroLvTarget,
|
fn: this.modelRtask.HeroLvTarget,
|
||||||
})
|
})
|
||||||
case comm.RtaskTypeHeroStarTarget:
|
case comm.Rtype6:
|
||||||
this.register(v.Id, &rtaskCondi{
|
this.register(v.Id, &rtaskCondi{
|
||||||
cfg: typeCfg,
|
cfg: typeCfg,
|
||||||
fn: this.modelRtask.HeroStarTarget,
|
fn: this.modelRtask.HeroStarTarget,
|
||||||
})
|
})
|
||||||
|
|
||||||
case comm.RtaskTypeEquipNum:
|
case comm.Rtype5:
|
||||||
this.register(v.Id, &rtaskCondi{
|
this.register(v.Id, &rtaskCondi{
|
||||||
cfg: typeCfg,
|
cfg: typeCfg,
|
||||||
fn: this.modelRtask.EquipNum,
|
fn: this.modelRtask.EquipNum,
|
||||||
})
|
})
|
||||||
|
|
||||||
case comm.RtaskTypePoltId:
|
case comm.Rtype2:
|
||||||
this.register(v.Id, &rtaskCondi{
|
this.register(v.Id, &rtaskCondi{
|
||||||
cfg: typeCfg,
|
cfg: typeCfg,
|
||||||
fn: this.modelRtask.PoltId,
|
fn: this.modelRtask.PoltId,
|
||||||
})
|
})
|
||||||
|
|
||||||
case comm.RtaskTypeTaskDay:
|
case comm.Rtype3:
|
||||||
this.register(v.Id, &rtaskCondi{
|
this.register(v.Id, &rtaskCondi{
|
||||||
cfg: typeCfg,
|
cfg: typeCfg,
|
||||||
fn: this.modelRtask.TaskDay,
|
fn: this.modelRtask.TaskDay,
|
||||||
@ -112,3 +113,7 @@ func (this *ModuleRtask) initRtaskHandle() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SendToRtask(session comm.IUserSession, rtaskType int32, params ...int32) (code pb.ErrorCode) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"go_dreamfactory/lego/sys/redis"
|
"go_dreamfactory/lego/sys/redis"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
|
||||||
"go_dreamfactory/utils"
|
"go_dreamfactory/utils"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -61,38 +60,6 @@ func (this *modelSmithy) modifySmithyDataByObjId(uid string, data map[string]int
|
|||||||
return this.Change(uid, data)
|
return this.Change(uid, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo 调用drop 表 获取掉落信息
|
|
||||||
func (this *modelSmithy) GetDropReward(count, dropId int32, Items []*pb.UserAssets) {
|
|
||||||
res := make([]*cfg.Gameatn, 0)
|
|
||||||
for i := 0; i < int(count); i++ {
|
|
||||||
data := this.module.configure.GetDropData(dropId)
|
|
||||||
szW := make([]int32, 0)
|
|
||||||
for _, value := range data {
|
|
||||||
szW = append(szW, value.P)
|
|
||||||
}
|
|
||||||
index := comm.GetRandW(szW)
|
|
||||||
res = append(res, data[index].Prize...)
|
|
||||||
}
|
|
||||||
for _, v := range res {
|
|
||||||
bFind := false
|
|
||||||
for _, v1 := range Items {
|
|
||||||
if v.A == v1.A && v.T == v1.T {
|
|
||||||
v1.N += v.N
|
|
||||||
bFind = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !bFind {
|
|
||||||
Items = append(Items, &pb.UserAssets{
|
|
||||||
A: v.A,
|
|
||||||
T: v.T,
|
|
||||||
N: v.N,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 计算订单信息
|
// 计算订单信息
|
||||||
func (this *modelSmithy) CalculationSmithy(uid string, Smithy *pb.DBSmithy) {
|
func (this *modelSmithy) CalculationSmithy(uid string, Smithy *pb.DBSmithy) {
|
||||||
var (
|
var (
|
||||||
@ -134,7 +101,7 @@ func (this *modelSmithy) CalculationSmithy(uid string, Smithy *pb.DBSmithy) {
|
|||||||
Smithy.OrderCostTime = 0 // 清空当天的订单时长
|
Smithy.OrderCostTime = 0 // 清空当天的订单时长
|
||||||
}
|
}
|
||||||
order.Count--
|
order.Count--
|
||||||
this.GetDropReward(1, _Smithycfg.Drop, Smithy.Items) // 获取掉落奖励
|
this.module.configure.GetMultipleDropReward(1, _Smithycfg.Drop, Smithy.Items) // 获取掉落奖励
|
||||||
|
|
||||||
if curTime > costTime {
|
if curTime > costTime {
|
||||||
Smithy.OrderCostTime += int32(curTime - costTime)
|
Smithy.OrderCostTime += int32(curTime - costTime)
|
||||||
|
@ -70,7 +70,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng
|
|||||||
viking.ChallengeTime[req.BossType<<16+req.Difficulty] = 0
|
viking.ChallengeTime[req.BossType<<16+req.Difficulty] = 0
|
||||||
code = this.module.ModifyVikingData(session.GetUserId(), mapData)
|
code = this.module.ModifyVikingData(session.GetUserId(), mapData)
|
||||||
// 发放通关随机奖励
|
// 发放通关随机奖励
|
||||||
this.module.GetDropReward(cfg.Drop, reward) // 获取掉落奖励
|
this.module.configure.GetDropReward(cfg.Drop, reward) // 获取掉落奖励
|
||||||
if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success {
|
if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"go_dreamfactory/lego/sys/redis"
|
"go_dreamfactory/lego/sys/redis"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||||
@ -40,37 +39,3 @@ func (this *modelViking) getVikingList(uid string) (result *pb.DBViking, err err
|
|||||||
func (this *modelViking) modifyVikingDataByObjId(uid string, data map[string]interface{}) error {
|
func (this *modelViking) modifyVikingDataByObjId(uid string, data map[string]interface{}) error {
|
||||||
return this.Change(uid, data)
|
return this.Change(uid, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo 调用drop 表 获取掉落信息
|
|
||||||
func (this *modelViking) GetDropReward(count, dropId int32, Items []*pb.UserAssets) {
|
|
||||||
res := make([]*cfg.Gameatn, 0)
|
|
||||||
for i := 0; i < int(count); i++ {
|
|
||||||
data := this.module.configure.GetDropData(dropId)
|
|
||||||
szW := make([]int32, 0)
|
|
||||||
for _, value := range data {
|
|
||||||
szW = append(szW, value.P)
|
|
||||||
}
|
|
||||||
if len(szW) > 0 {
|
|
||||||
index := comm.GetRandW(szW)
|
|
||||||
res = append(res, data[index].Prize...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, v := range res {
|
|
||||||
bFind := false
|
|
||||||
for _, v1 := range Items {
|
|
||||||
if v.A == v1.A && v.T == v1.T {
|
|
||||||
v1.N += v.N
|
|
||||||
bFind = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !bFind {
|
|
||||||
Items = append(Items, &pb.UserAssets{
|
|
||||||
A: v.A,
|
|
||||||
T: v.T,
|
|
||||||
N: v.N,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Viking struct {
|
type Viking struct {
|
||||||
@ -51,16 +50,3 @@ func (this *Viking) ModifyVikingData(uid string, data map[string]interface{}) (c
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func (this *Viking) GetDropReward(dropId int32, Items []*cfg.Gameatn) {
|
|
||||||
Items = make([]*cfg.Gameatn, 0)
|
|
||||||
|
|
||||||
data := this.configure.GetDropData(dropId)
|
|
||||||
szW := make([]int32, 0)
|
|
||||||
for _, value := range data {
|
|
||||||
szW = append(szW, value.P)
|
|
||||||
}
|
|
||||||
index := comm.GetRandW(szW)
|
|
||||||
Items = append(Items, data[index].Prize...)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
@ -67,6 +67,7 @@ func (x *FrtaskIds) GetRtaskIds() []int32 {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 玩家任务状态
|
||||||
type DBRtask struct {
|
type DBRtask struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@ -146,6 +147,86 @@ func (x *DBRtask) GetIsReward() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 玩家任务记录
|
||||||
|
type DBRtaskRecord struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
|
||||||
|
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||||
|
RType int32 `protobuf:"varint,3,opt,name=rType,proto3" json:"rType" bson:"rType"` //任务类型
|
||||||
|
Vals map[int32]int32 `protobuf:"bytes,4,rep,name=vals,proto3" json:"vals" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"vals"` //任务记录值
|
||||||
|
Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp"` //@go_tasg(`bson:"timestamp"`) 时间戳
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBRtaskRecord) Reset() {
|
||||||
|
*x = DBRtaskRecord{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_rtask_rtask_db_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBRtaskRecord) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*DBRtaskRecord) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *DBRtaskRecord) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_rtask_rtask_db_proto_msgTypes[2]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use DBRtaskRecord.ProtoReflect.Descriptor instead.
|
||||||
|
func (*DBRtaskRecord) Descriptor() ([]byte, []int) {
|
||||||
|
return file_rtask_rtask_db_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBRtaskRecord) GetId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBRtaskRecord) GetUid() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Uid
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBRtaskRecord) GetRType() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.RType
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBRtaskRecord) GetVals() map[int32]int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Vals
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBRtaskRecord) GetTimestamp() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Timestamp
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
var File_rtask_rtask_db_proto protoreflect.FileDescriptor
|
var File_rtask_rtask_db_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_rtask_rtask_db_proto_rawDesc = []byte{
|
var file_rtask_rtask_db_proto_rawDesc = []byte{
|
||||||
@ -167,8 +248,21 @@ var file_rtask_rtask_db_proto_rawDesc = []byte{
|
|||||||
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
|
0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
|
||||||
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x66, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64,
|
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x66, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64,
|
||||||
0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04,
|
0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xcc, 0x01, 0x0a,
|
||||||
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x0d, 0x44, 0x42, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x0e,
|
||||||
|
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10,
|
||||||
|
0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
|
||||||
|
0x12, 0x14, 0x0a, 0x05, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||||
|
0x05, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x18, 0x04,
|
||||||
|
0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x44, 0x42, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65,
|
||||||
|
0x63, 0x6f, 0x72, 0x64, 0x2e, 0x56, 0x61, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04,
|
||||||
|
0x76, 0x61, 0x6c, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
|
||||||
|
0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
|
||||||
|
0x6d, 0x70, 0x1a, 0x37, 0x0a, 0x09, 0x56, 0x61, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
|
||||||
|
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65,
|
||||||
|
0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
|
||||||
|
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e,
|
||||||
|
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -183,20 +277,23 @@ func file_rtask_rtask_db_proto_rawDescGZIP() []byte {
|
|||||||
return file_rtask_rtask_db_proto_rawDescData
|
return file_rtask_rtask_db_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_rtask_rtask_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
var file_rtask_rtask_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||||
var file_rtask_rtask_db_proto_goTypes = []interface{}{
|
var file_rtask_rtask_db_proto_goTypes = []interface{}{
|
||||||
(*FrtaskIds)(nil), // 0: frtaskIds
|
(*FrtaskIds)(nil), // 0: frtaskIds
|
||||||
(*DBRtask)(nil), // 1: DBRtask
|
(*DBRtask)(nil), // 1: DBRtask
|
||||||
nil, // 2: DBRtask.FrtaskIdsEntry
|
(*DBRtaskRecord)(nil), // 2: DBRtaskRecord
|
||||||
|
nil, // 3: DBRtask.FrtaskIdsEntry
|
||||||
|
nil, // 4: DBRtaskRecord.ValsEntry
|
||||||
}
|
}
|
||||||
var file_rtask_rtask_db_proto_depIdxs = []int32{
|
var file_rtask_rtask_db_proto_depIdxs = []int32{
|
||||||
2, // 0: DBRtask.frtaskIds:type_name -> DBRtask.FrtaskIdsEntry
|
3, // 0: DBRtask.frtaskIds:type_name -> DBRtask.FrtaskIdsEntry
|
||||||
0, // 1: DBRtask.FrtaskIdsEntry.value:type_name -> frtaskIds
|
4, // 1: DBRtaskRecord.vals:type_name -> DBRtaskRecord.ValsEntry
|
||||||
2, // [2:2] is the sub-list for method output_type
|
0, // 2: DBRtask.FrtaskIdsEntry.value:type_name -> frtaskIds
|
||||||
2, // [2:2] is the sub-list for method input_type
|
3, // [3:3] is the sub-list for method output_type
|
||||||
2, // [2:2] is the sub-list for extension type_name
|
3, // [3:3] is the sub-list for method input_type
|
||||||
2, // [2:2] is the sub-list for extension extendee
|
3, // [3:3] is the sub-list for extension type_name
|
||||||
0, // [0:2] is the sub-list for field type_name
|
3, // [3:3] is the sub-list for extension extendee
|
||||||
|
0, // [0:3] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_rtask_rtask_db_proto_init() }
|
func init() { file_rtask_rtask_db_proto_init() }
|
||||||
@ -229,6 +326,18 @@ func file_rtask_rtask_db_proto_init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
file_rtask_rtask_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*DBRtaskRecord); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
@ -236,7 +345,7 @@ func file_rtask_rtask_db_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_rtask_rtask_db_proto_rawDesc,
|
RawDescriptor: file_rtask_rtask_db_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 3,
|
NumMessages: 5,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user