Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
2188bb269a
@ -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)
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
//参数校验
|
//参数校验
|
||||||
func (this *apiComp) DeskSkillLvCkeck(session comm.IUserSession, req *pb.SmithyDeskSkillLvReq) (code pb.ErrorCode) {
|
func (this *apiComp) DeskSkillLvCheck(session comm.IUserSession, req *pb.SmithyDeskSkillLvReq) (code pb.ErrorCode) {
|
||||||
if req.DeskType == 0 {
|
if req.DeskType == 0 {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
code = pb.ErrorCode_ReqParameterError
|
||||||
}
|
}
|
||||||
@ -23,7 +23,7 @@ func (this *apiComp) DeskSkillLv(session comm.IUserSession, req *pb.SmithyDeskSk
|
|||||||
bFindSkill bool
|
bFindSkill bool
|
||||||
curSkillCfg *cfg.GameSmithyData
|
curSkillCfg *cfg.GameSmithyData
|
||||||
)
|
)
|
||||||
code = this.DeskSkillLvCkeck(session, req)
|
code = this.DeskSkillLvCheck(session, req)
|
||||||
if code != pb.ErrorCode_Success {
|
if code != pb.ErrorCode_Success {
|
||||||
return // 参数校验失败直接返回
|
return // 参数校验失败直接返回
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
//参数校验
|
//参数校验
|
||||||
func (this *apiComp) StoveSkillLvCkeck(session comm.IUserSession, req *pb.SmithyStoveSkillLvReq) (code pb.ErrorCode) {
|
func (this *apiComp) StoveSkillLvCheck(session comm.IUserSession, req *pb.SmithyStoveSkillLvReq) (code pb.ErrorCode) {
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *apiComp) StoveSkillLv(session comm.IUserSession, req *pb.SmithyStoveSkillLvReq) (code pb.ErrorCode, dat proto.Message) {
|
func (this *apiComp) StoveSkillLv(session comm.IUserSession, req *pb.SmithyStoveSkillLvReq) (code pb.ErrorCode, dat proto.Message) {
|
||||||
|
|
||||||
code = this.StoveSkillLvCkeck(session, req)
|
code = this.StoveSkillLvCheck(session, req)
|
||||||
if code != pb.ErrorCode_Success {
|
if code != pb.ErrorCode_Success {
|
||||||
return // 参数校验失败直接返回
|
return // 参数校验失败直接返回
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ func (this *configureComp) GetSmithyConfigData(smithyType int32, level int32) (d
|
|||||||
return this._smithyMap[int64(smithyType<<16)+int64(level)]
|
return this._smithyMap[int64(smithyType<<16)+int64(level)]
|
||||||
}
|
}
|
||||||
func (this *configureComp) GetSmithyTypeConfigData() (mapType map[int32]struct{}) {
|
func (this *configureComp) GetSmithyTypeConfigData() (mapType map[int32]struct{}) {
|
||||||
|
mapType = make(map[int32]struct{}, 0)
|
||||||
if v, err := this.GetConfigure(game_smithy); err == nil {
|
if v, err := this.GetConfigure(game_smithy); err == nil {
|
||||||
if configure, ok := v.(*cfg.GameSmithy); ok {
|
if configure, ok := v.(*cfg.GameSmithy); ok {
|
||||||
for _, v1 := range configure.GetDataList() {
|
for _, v1 := range configure.GetDataList() {
|
||||||
|
@ -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
|
|
||||||
}
|
|
||||||
|
@ -18,6 +18,7 @@ import (
|
|||||||
"go_dreamfactory/modules/pagoda"
|
"go_dreamfactory/modules/pagoda"
|
||||||
"go_dreamfactory/modules/rtask"
|
"go_dreamfactory/modules/rtask"
|
||||||
"go_dreamfactory/modules/shop"
|
"go_dreamfactory/modules/shop"
|
||||||
|
"go_dreamfactory/modules/smithy"
|
||||||
"go_dreamfactory/modules/task"
|
"go_dreamfactory/modules/task"
|
||||||
"go_dreamfactory/modules/user"
|
"go_dreamfactory/modules/user"
|
||||||
"go_dreamfactory/modules/viking"
|
"go_dreamfactory/modules/viking"
|
||||||
@ -67,6 +68,7 @@ func main() {
|
|||||||
martialhall.NewModule(),
|
martialhall.NewModule(),
|
||||||
rtask.NewModule(),
|
rtask.NewModule(),
|
||||||
viking.NewModule(),
|
viking.NewModule(),
|
||||||
|
smithy.NewModule(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user