Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
30c82b64ed
@ -30,6 +30,6 @@ func NewNotFoundConfErr(moduleName string, filename string, id interface{}) erro
|
||||
}
|
||||
|
||||
//执行外部模块异常
|
||||
func NewExternalModuleErr(moduleName string, methodname string, parameter ...interface{}) error {
|
||||
return fmt.Errorf("执行外部模块错误 模块:%s ,配置文件:%s,目标数据:%v", moduleName, methodname, parameter)
|
||||
func NewExternalModuleErr(moduleName string, methodname string, parameter interface{}) error {
|
||||
return fmt.Errorf("执行外部模块错误 模块:%s ,配置文件:%s,错误信息:%v", moduleName, methodname, parameter)
|
||||
}
|
||||
|
@ -22,11 +22,19 @@ func (this *apiComp) ChanageChannel(session comm.IUserSession, req *pb.ChatChana
|
||||
|
||||
if err, ok = this.module.modelChat.chanageChannel(session, req.ChannelId); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if ok {
|
||||
if err = this.module.modelChat.removeCrossChannelMember(session.GetUserId()); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
|
||||
|
@ -22,6 +22,10 @@ func (this *apiComp) CrossChannel(session comm.IUserSession, req *pb.ChatCrossCh
|
||||
}
|
||||
if channel, err = this.module.modelChat.addCrossChannelMember(session); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
|
||||
|
@ -1,6 +1,7 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
@ -29,18 +30,30 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.ChatGetListReq)
|
||||
case pb.ChatChannel_World:
|
||||
if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
break
|
||||
case pb.ChatChannel_Union:
|
||||
if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), req.UnionId, 0); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
break
|
||||
case pb.ChatChannel_Private:
|
||||
if list, err = this.module.modelChat.queryUserMsg(session.GetUserId()); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
break
|
||||
@ -48,26 +61,47 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.ChatGetListReq)
|
||||
if result, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
code = pb.ErrorCode_DBError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if req.ChannelId != result.Chatchannel {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: fmt.Sprintf("req.ChannelId:%d != result.Chatchannel:%d", req.ChannelId, result.Chatchannel),
|
||||
}
|
||||
return
|
||||
}
|
||||
if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", req.ChannelId); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
break
|
||||
case pb.ChatChannel_System:
|
||||
if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
break
|
||||
default:
|
||||
|
||||
this.module.Errorf("不存在的聊天频道类型channel:%d ", req.Channel)
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
this.module.Errorf("getlist no support channel:%d ", req.Channel)
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: fmt.Sprintf("不存在的聊天频道类型 channel:%d ", req.Channel),
|
||||
}
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "getlist", &pb.ChatGetListResp{Chats: list})
|
||||
|
@ -2,6 +2,7 @@ package chat
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/wordfilter"
|
||||
@ -49,6 +50,10 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
|
||||
|
||||
if max_chat, err = this.module.configure.GetChannelRecordMax(); err != nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -76,16 +81,6 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
|
||||
go this.module.modelChat.sendChatToWorld(msg, max_chat)
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype62, 1)
|
||||
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype62, 1))
|
||||
//随机任务
|
||||
// if _, err = this.service.AcrossClusterRpcGo(
|
||||
// context.Background(),
|
||||
// session.GetServiecTag(),
|
||||
// comm.Service_Worker,
|
||||
// string(comm.Rpc_ModuleRtaskSendTask),
|
||||
// pb.RPCRTaskReq{Uid: session.GetUserId(), TaskType: int32(comm.Rtype62), Param1: 1},
|
||||
// nil); err != nil {
|
||||
// this.module.Errorln(err)
|
||||
// }
|
||||
break
|
||||
case pb.ChatChannel_Union:
|
||||
if msg.Ctype == pb.ChatType_Text { //过滤敏感词
|
||||
@ -120,8 +115,12 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
|
||||
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype106, 1))
|
||||
break
|
||||
default:
|
||||
this.module.Errorf("不存在的聊天频道类型channel:%d ", req.Channel)
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
this.module.Errorf("getlist no support channel:%d ", req.Channel)
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: fmt.Sprintf("不存在的聊天频道类型 channel:%d ", req.Channel),
|
||||
}
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "send", &pb.ChatSendResp{Issucc: true})
|
||||
|
@ -1,7 +1,7 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
@ -62,13 +62,15 @@ func (this *configureComp) GetAutoIntoChannelMax() (max int32, err error) {
|
||||
return
|
||||
} else {
|
||||
if configure, ok = v.(*cfg.GameChatChannelCom).GetDataMap()["channel_allocation_max"]; !ok {
|
||||
err = fmt.Errorf("cfg.Game_chatServerGroupData on found channel_allocation_max")
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "channel_allocation_max")
|
||||
// err = fmt.Errorf("cfg.Game_chatServerGroupData on found channel_allocation_max")
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
max = configure.Value
|
||||
if max <= 0 {
|
||||
err = fmt.Errorf("cfg.GamechatChannelComData channel_allocation_max:%v", v)
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "channel_allocation_max:0")
|
||||
// err = fmt.Errorf("cfg.GamechatChannelComData channel_allocation_max:%v", v)
|
||||
}
|
||||
}
|
||||
return
|
||||
@ -86,13 +88,15 @@ func (this *configureComp) GetChanageChannelMax() (max int32, err error) {
|
||||
return
|
||||
} else {
|
||||
if configure, ok = v.(*cfg.GameChatChannelCom).GetDataMap()["channel_switching_max"]; !ok {
|
||||
err = fmt.Errorf("cfg.Game_chatServerGroupData on found channel_switching_max")
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "channel_switching_max")
|
||||
// err = fmt.Errorf("cfg.Game_chatServerGroupData on found channel_switching_max")
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
max = configure.Value
|
||||
if max <= 0 {
|
||||
err = fmt.Errorf("cfg.GamechatChannelComData channel_switching_max:%v", v)
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "channel_switching_max:0")
|
||||
// err = fmt.Errorf("cfg.GamechatChannelComData channel_switching_max:%v", v)
|
||||
}
|
||||
}
|
||||
return
|
||||
@ -110,13 +114,15 @@ func (this *configureComp) GetChannelRecordMax() (max int32, err error) {
|
||||
return
|
||||
} else {
|
||||
if configure, ok = v.(*cfg.GameChatChannelCom).GetDataMap()["max_chat"]; !ok {
|
||||
err = fmt.Errorf("cfg.Game_chatServerGroupData on found max_chat")
|
||||
this.module.Errorf("err:%v", err)
|
||||
// err = fmt.Errorf("cfg.Game_chatServerGroupData on found max_chat")
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "max_chat")
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
max = configure.Value
|
||||
if max <= 0 {
|
||||
err = fmt.Errorf("cfg.GamechatChannelComData max_chat:%v", v)
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "max_chat:0")
|
||||
// err = fmt.Errorf("cfg.GamechatChannelComData max_chat:%v", v)
|
||||
}
|
||||
}
|
||||
return
|
||||
@ -134,13 +140,15 @@ func (this *configureComp) GetChannelReadRecordNum() (max int32, err error) {
|
||||
return
|
||||
} else {
|
||||
if configure, ok = v.(*cfg.GameChatChannelCom).GetDataMap()["load_chat"]; !ok {
|
||||
err = fmt.Errorf("cfg.Game_chatServerGroupData on found max_chat")
|
||||
// err = fmt.Errorf("cfg.Game_chatServerGroupData on found max_chat")
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "load_chat")
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
max = configure.Value
|
||||
if max <= 0 {
|
||||
err = fmt.Errorf("cfg.GamechatChannelComData max_chat:%v", v)
|
||||
// err = fmt.Errorf("cfg.GamechatChannelComData max_chat:%v", v)
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "load_chat:0")
|
||||
}
|
||||
}
|
||||
return
|
||||
|
@ -16,6 +16,8 @@ import (
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
)
|
||||
|
||||
const moduleName = "聊天"
|
||||
|
||||
/*
|
||||
模块名:论坛
|
||||
描述:处理跨服社交论坛相关业务
|
||||
|
@ -1,6 +1,7 @@
|
||||
package combat
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
@ -37,7 +38,12 @@ func (this *apiComp) AskPass(session comm.IUserSession, req *pb.CombatAskPassReq
|
||||
}
|
||||
if level, ok = info.Level[req.Level]; !ok {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
this.module.Errorf("no in Level:%s", req.Level)
|
||||
err = fmt.Errorf("没有目标关卡数据 req.Level: %d", req.Level)
|
||||
this.module.Errorln(err)
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -46,7 +52,7 @@ func (this *apiComp) AskPass(session comm.IUserSession, req *pb.CombatAskPassReq
|
||||
code = pb.ErrorCode_ExternalModule
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: comm.NewExternalModuleErr("Buried", "CheckCondition", session.GetUserId(), lvconf.Maintask).Error(),
|
||||
Message: comm.NewExternalModuleErr("Buried", "CheckCondition", lvconf.Maintask).Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -39,11 +39,19 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.CombatChalleng
|
||||
}
|
||||
}()
|
||||
if cd = this.ChallengeCheck(session, req); cd != pb.ErrorCode_Success {
|
||||
data = &pb.ErrorData{
|
||||
Title: cd.ToString(),
|
||||
Message: req.String(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if manster, err = this.module.configure.getGameCombatManster(req.Manster); err != nil {
|
||||
cd = pb.ErrorCode_ConfigNoFound
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
cd, record = this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
|
@ -1,6 +1,7 @@
|
||||
package combat
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
@ -42,24 +43,45 @@ func (this *apiComp) ChallengeReceive(session comm.IUserSession, req *pb.CombatC
|
||||
if iswin {
|
||||
if info, err = this.module.modelCombat.queryInfo(session.GetUserId()); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if lv, ok = info.Level[req.Level]; !ok {
|
||||
err = fmt.Errorf("没有目标关卡数据 req.Level: %d", req.Level)
|
||||
this.module.Errorln(err)
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
this.module.Errorf("no in Level:%s", req.Level)
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if lvconf, err = this.module.configure.getCombatLevel(req.Level); err != nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if manster, err = this.module.configure.getGameCombatManster(req.Manster); err != nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
for _, v := range lv.Passmanster {
|
||||
if v == req.Manster {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: fmt.Sprintf("req.Manster:%d 重复", code),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -67,6 +89,10 @@ func (this *apiComp) ChallengeReceive(session comm.IUserSession, req *pb.CombatC
|
||||
lv.Passmanster = append(lv.Passmanster, req.Manster)
|
||||
if err = this.module.modelCombat.updateInfo(info); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -82,6 +108,10 @@ func (this *apiComp) ChallengeReceive(session comm.IUserSession, req *pb.CombatC
|
||||
lv.Progress = int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), lvconf.Debrisitemid))
|
||||
if err = this.module.modelCombat.updateInfo(info); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package equipment
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
@ -32,6 +33,10 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
|
||||
}
|
||||
if conf, err = this.module.configure.getEquipenchanting(req.Itemid); err != nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
need = make([]*cfg.Gameatn, 0)
|
||||
@ -48,10 +53,18 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
|
||||
if equip, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.Eid); err != nil {
|
||||
this.module.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), req.Eid, err)
|
||||
code = pb.ErrorCode_SystemError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if equip.AdverbEntry[req.Index] == nil || equip.AdverbEntry[req.Index].AttrName != conf.Attrkey {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: req.String(),
|
||||
}
|
||||
return
|
||||
}
|
||||
AttrValue = rand.Int31n(conf.AttrMax-conf.AttrMini) + conf.AttrMini
|
||||
@ -64,12 +77,20 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
|
||||
}); err != nil {
|
||||
log.Errorf("Upgrade err:%v", err)
|
||||
code = pb.ErrorCode_SystemError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if equip.HeroId != "" {
|
||||
equipments = make([]*pb.DB_Equipment, 8)
|
||||
if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), equip.HeroId); code != pb.ErrorCode_Success {
|
||||
this.module.Errorf("Upgrade code:%d", code)
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: fmt.Sprintf("英雄唯一 id:%s", equip.HeroId),
|
||||
}
|
||||
return
|
||||
}
|
||||
for i, v := range hero.EquipID {
|
||||
@ -78,6 +99,10 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
|
||||
if equipments[i], err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), v); err != nil {
|
||||
log.Errorf("Upgrade err:%v", err)
|
||||
code = pb.ErrorCode_EquipmentOnFoundEquipment
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: fmt.Sprintf("装备唯一 id:%s", v),
|
||||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package equipment
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
@ -35,6 +36,10 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
||||
)
|
||||
|
||||
if code = this.EquipCheck(session, req); code != pb.ErrorCode_Success {
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: req.String(),
|
||||
}
|
||||
return
|
||||
}
|
||||
//校验数据
|
||||
@ -43,6 +48,10 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
||||
|
||||
//获取英雄数据
|
||||
if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), req.HeroCardId); code != pb.ErrorCode_Success {
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: fmt.Sprintf("获取英雄数据失败:%s", req.HeroCardId),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -56,6 +65,10 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
||||
}
|
||||
if equipments[i].HeroId != "" && hero.Id != equipments[i].HeroId { //装备已经有宿主了
|
||||
code = pb.ErrorCode_EquipmentIsWorn
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: fmt.Sprintf("装备已穿戴 装备id:%s 英雄id:%s", hero.Id, equipments[i].HeroId),
|
||||
}
|
||||
return
|
||||
}
|
||||
if minlv > equipments[i].Lv {
|
||||
@ -65,6 +78,10 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
||||
if confs[i], err = this.module.configure.GetEquipmentConfigureById(equipments[i].CId); err != nil {
|
||||
this.module.Errorf("Equip_Check err:%v", err)
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if minstr > confs[i].Star {
|
||||
@ -100,6 +117,10 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
||||
if equipment, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), v); err != nil {
|
||||
this.module.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), v, err)
|
||||
code = pb.ErrorCode_SystemError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
equipment.HeroId = ""
|
||||
@ -109,6 +130,10 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
||||
if equipment, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), v); err != nil {
|
||||
this.module.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), v, err)
|
||||
code = pb.ErrorCode_SystemError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
equipment.HeroId = ""
|
||||
@ -170,40 +195,38 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
||||
//更新装备数据加成
|
||||
if code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments); code != pb.ErrorCode_Success {
|
||||
this.module.Errorf("Equip ModuleHero UpdateEquipment code%v", code)
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: comm.NewExternalModuleErr("ModuleHero", "UpdateEquipment", code).Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
//同步数据
|
||||
if err = this.module.modelEquipment.UpdateByHeroId(session.GetUserId(), updatequipment...); err != nil {
|
||||
this.module.Errorf("Equip err%v", err)
|
||||
code = pb.ErrorCode_SystemError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype5, equipNum, utils.ToInt32(hero.HeroID)))
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype5, utils.ToInt32(hero.HeroID), equipNum)
|
||||
// for k, v := range equipStr {
|
||||
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype41, 1, v, k))
|
||||
// // this.module.ModuleRtask.SendToRtask(session, comm.Rtype41, utils.ToInt32(hero.HeroID), v, k)
|
||||
// }
|
||||
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype41, 1, equipNum, minstr))
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype42, 1, equipNum, minlv))
|
||||
// for k, v := range equipLv {
|
||||
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype42, 1, v, k))
|
||||
// // this.module.ModuleRtask.SendToRtask(session, comm.Rtype42, utils.ToInt32(hero.HeroID), v, k)
|
||||
// }
|
||||
|
||||
if hero.SuiteId != 0 {
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype46, 1, hero.Suite1Star, hero.SuiteId))
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv))
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype98, 1, hero.Suite1Lv))
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype169, hero.SuiteId))
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv)
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype98, 1, hero.Suite1Lv)
|
||||
|
||||
}
|
||||
if hero.SuiteExtId != 0 {
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype46, 1, hero.Suite2Star, hero.SuiteExtId))
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv))
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype98, 1, hero.Suite1Lv))
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv)
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype98, 1, hero.Suite1Lv)
|
||||
}
|
||||
|
||||
if len(tasks) > 0 {
|
||||
|
@ -24,10 +24,18 @@ func (this *apiComp) Forg(session comm.IUserSession, req *pb.EquipmentForgReq) (
|
||||
err error
|
||||
)
|
||||
if code = this.ForgCheck(session, req); code != pb.ErrorCode_Success {
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: req.String(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if conf, err = this.module.configure.GetEquipCompose(req.Forgid); err != nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
need = make([]*cfg.Gameatn, len(conf.Need))
|
||||
|
@ -20,6 +20,10 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.EquipmentGetList
|
||||
if items, err = this.module.modelEquipment.QueryUserEquipments(session.GetUserId()); err != nil {
|
||||
this.module.Errorf("QueryUserPackReq err:%v", err)
|
||||
code = pb.ErrorCode_CacheReadError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "getlist", &pb.EquipmentGetListResp{Equipments: items})
|
||||
|
@ -25,6 +25,10 @@ func (this *apiComp) Lock(session comm.IUserSession, req *pb.EquipmentLockReq) (
|
||||
if equipment, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.EquipmentId); err != nil {
|
||||
this.module.Errorln(err)
|
||||
code = pb.ErrorCode_EquipmentOnFoundEquipment
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
equipment.Islock = req.IsLock
|
||||
@ -33,6 +37,10 @@ func (this *apiComp) Lock(session comm.IUserSession, req *pb.EquipmentLockReq) (
|
||||
}); err != nil {
|
||||
this.module.Errorln(err)
|
||||
code = pb.ErrorCode_DBError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "lock", &pb.EquipmentLockResp{IsSucc: true, EquipmentId: req.EquipmentId, IsLock: req.IsLock})
|
||||
|
@ -1,6 +1,7 @@
|
||||
package equipment
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
@ -28,6 +29,10 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.EquipmentSellReq) (
|
||||
}
|
||||
if equipments, err = this.module.modelEquipment.QueryUserEquipmentsByIds(session.GetUserId(), req.EquipIds); err != nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
confs = make([]*cfg.GameEquipData, len(equipments))
|
||||
@ -36,15 +41,27 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.EquipmentSellReq) (
|
||||
if v.HeroId != "" || v.Islock {
|
||||
code = pb.ErrorCode_EquipmentNoCanSell
|
||||
this.module.Errorf("NoCanSell %v", v)
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: fmt.Sprintf("装备已锁定! 装备id:%s", v),
|
||||
}
|
||||
return
|
||||
}
|
||||
if confs[i], err = this.module.configure.GetEquipmentConfigureById(v.CId); err != nil {
|
||||
this.module.Errorln(err)
|
||||
code = pb.ErrorCode_EquipmentOnFoundEquipment
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if confs[i].Sale == nil || len(confs[i].Sale) == 0 {
|
||||
code = pb.ErrorCode_EquipmentNoCanSell
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: fmt.Sprintf("装备出售配置为空! 装备id:%s", confs[i].Id),
|
||||
}
|
||||
return
|
||||
}
|
||||
sale[i] = make([]*cfg.Gameatn, len(confs[i].Sale))
|
||||
|
@ -38,22 +38,38 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
||||
tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0)
|
||||
)
|
||||
if code = this.UpgradeCheck(session, req); code != pb.ErrorCode_Success {
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: req.String(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if equipment, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.EquipmentId); err != nil {
|
||||
this.module.Errorf("Equip_Check err:%v", err)
|
||||
code = pb.ErrorCode_EquipmentOnFoundEquipment
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if conf, err = this.module.configure.GetEquipmentConfigureById(equipment.CId); err != nil {
|
||||
this.module.Errorf("Equip_Check err:%v", err)
|
||||
code = pb.ErrorCode_EquipmentOnFoundEquipment
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
//找到下一个等级的相关配置
|
||||
if intensify, err = this.module.configure.GetEquipmentIntensifyConfigureById(conf.EquipId, conf.Star, equipment.Lv); err != nil || intensify.Need == nil || len(intensify.Need) == 0 {
|
||||
this.module.Errorf("Equip_Check err:%v", err)
|
||||
code = pb.ErrorCode_EquipmentLvlimitReached
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if code = this.module.ConsumeRes(session, intensify.Need, true); code != pb.ErrorCode_Success {
|
||||
@ -74,6 +90,10 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
||||
}); err != nil {
|
||||
log.Errorf("Upgrade err:%v", err)
|
||||
code = pb.ErrorCode_SystemError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -89,6 +109,10 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
||||
}); err != nil {
|
||||
this.module.Errorf("Upgrade err:%v", err)
|
||||
code = pb.ErrorCode_SystemError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
modifyequipments = append(modifyequipments, equipment)
|
||||
@ -99,12 +123,20 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
||||
modifyequipments = append(modifyequipments, equipment)
|
||||
if err = this.module.modelEquipment.upgradeEquipment(equipment, conf, intensify); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
this.module.Errorf("Upgrade err:%v", err)
|
||||
return
|
||||
}
|
||||
if err = this.module.modelEquipment.AddList(session.GetUserId(), equipment.Id, equipment); err != nil {
|
||||
this.module.Errorf("Upgrade err:%v", err)
|
||||
code = pb.ErrorCode_SystemError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
@ -113,6 +145,10 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
||||
if err = this.module.modelEquipment.upgradeEquipment(equipment, conf, intensify); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
this.module.Errorf("Upgrade err:%v", err)
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if err = this.module.modelEquipment.ChangeList(session.GetUserId(), equipment.Id, map[string]interface{}{
|
||||
@ -125,6 +161,10 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
||||
}); err != nil {
|
||||
log.Errorf("Upgrade err:%v", err)
|
||||
code = pb.ErrorCode_SystemError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -134,11 +174,17 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
||||
if equipment.HeroId != "" {
|
||||
if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), equipment.HeroId); code != pb.ErrorCode_Success {
|
||||
this.module.Errorf("Upgrade code:%d", code)
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if conf.Pos >= 8 {
|
||||
code = pb.ErrorCode_ConfigurationException
|
||||
this.module.Errorf("Upgrade equipment Pos:%d", conf.Pos)
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
hero.EquipID[conf.Pos] = equipment.Id //拆分后的装备是一个新的
|
||||
@ -182,32 +228,21 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
||||
}
|
||||
//随机任务触发
|
||||
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype43, equipment.Id, equipment.Lv))
|
||||
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype44, 1, equipment.Lv))
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype47, 1))
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype43, 1, equipment.Lv)
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype44, equipment.Lv)
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype47, 1)
|
||||
|
||||
if conf.Pos == 7 {
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype102, 1))
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype102, 1)
|
||||
} else if conf.Pos == 6 {
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype100, 1))
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype100, 1)
|
||||
}
|
||||
//聊天系统通知
|
||||
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
||||
// var color *cfg.GameGameColorData
|
||||
// if color, err = this.module.configure.GetColor(conf.Color); err == nil {
|
||||
this.module.chat.SendSysChatToWorld(comm.ChatSystem3, equipment, equipment.Lv, 0, user.Name, conf.Id)
|
||||
// } else {
|
||||
// this.module.Errorf("GetColor err:%s", err.Error())
|
||||
// }
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
} else {
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype96, 1))
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype96, 1)
|
||||
}
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype92, 1))
|
||||
if len(tasks) > 0 {
|
||||
|
@ -26,16 +26,28 @@ func (this *apiComp) Wash(session comm.IUserSession, req *pb.EquipmentWashReq) (
|
||||
err error
|
||||
)
|
||||
if code = this.WashCheck(session, req); code != pb.ErrorCode_Success {
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: req.String(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if equip, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.Eid); err != nil {
|
||||
this.module.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), req.Eid, err)
|
||||
code = pb.ErrorCode_SystemError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if conf, err = this.module.configure.GetEquipmentConfigureById(equip.CId); err != nil {
|
||||
this.module.Errorf("Equip_Check err:%v", err)
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
gole := this.module.ModuleTools.GetGlobalConf().EquipmentConsumption[conf.Color-1]
|
||||
|
@ -23,20 +23,36 @@ func (this *apiComp) WashConfirm(session comm.IUserSession, req *pb.EquipmentWas
|
||||
err error
|
||||
)
|
||||
if code = this.WashConfirmCheck(session, req); code != pb.ErrorCode_Success {
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: req.String(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if equip, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.Eid); err != nil {
|
||||
this.module.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), req.Eid, err)
|
||||
code = pb.ErrorCode_SystemError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if len(equip.AdverbEntry) != len(req.Pids) {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
for i, v := range equip.AdverbEntry {
|
||||
if attrlibrary, err = this.module.configure.GetEquipmentAttrlibraryConfigureByKey(req.Pids[i]); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
equip.AdverbEntry[i] = &pb.EquipmentAttributeEntry{
|
||||
@ -53,6 +69,10 @@ func (this *apiComp) WashConfirm(session comm.IUserSession, req *pb.EquipmentWas
|
||||
}); err != nil {
|
||||
log.Errorf("Upgrade err:%v", err)
|
||||
code = pb.ErrorCode_SystemError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "washconfirm", &pb.EquipmentWashConfirmResp{Issucc: true})
|
||||
|
@ -2,6 +2,7 @@ package equipment
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
@ -122,9 +123,7 @@ func (this *configureComp) GetEquipmentConfigureByIds(equipmentId []string) (con
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
} else {
|
||||
|
||||
configure = make([]*cfg.GameEquipData, len(equipmentId))
|
||||
|
||||
for i, v := range equipmentId {
|
||||
if c, ok = t.(*cfg.GameEquip).GetDataMap()[v]; ok {
|
||||
configure[i] = c
|
||||
@ -165,8 +164,8 @@ func (this *configureComp) GetEquipmentAttrlibraryConfigureByKey(key int32) (con
|
||||
return
|
||||
} else {
|
||||
if configure, ok = v.(*cfg.GameEquipAttrlibraryS).GetDataMap()[key]; !ok {
|
||||
|
||||
err = fmt.Errorf("EquipmentConfigure GetEquipmentAttrlibraryConfigureByKey not found:%d ", key)
|
||||
err = comm.NewNotFoundConfErr(moduleName, equip_attrlibrary, key)
|
||||
// err = fmt.Errorf("EquipmentConfigure GetEquipmentAttrlibraryConfigureByKey not found:%d ", key)
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
@ -270,7 +269,8 @@ func (this *configureComp) getEquipAttribute(sid string) (result *cfg.GameEquipA
|
||||
return
|
||||
} else {
|
||||
if result, ok = v.(*cfg.GameEquipAttribute).GetDataMap()[sid]; !ok {
|
||||
err = fmt.Errorf("on found getEquipAttribute id:%s", sid)
|
||||
// err = fmt.Errorf("on found getEquipAttribute id:%s", sid)
|
||||
err = comm.NewNotFoundConfErr(moduleName, equip_attrlibrary, sid)
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
@ -289,7 +289,8 @@ func (this *configureComp) getEquipenchanting(id string) (result *cfg.GameEquipE
|
||||
return
|
||||
} else {
|
||||
if result, ok = v.(*cfg.GameEquipEnchanting).GetDataMap()[id]; !ok {
|
||||
err = fmt.Errorf("on found getEquipenchanting id:%s", id)
|
||||
err = comm.NewNotFoundConfErr(moduleName, equip_attrlibrary, id)
|
||||
// err = fmt.Errorf("on found getEquipenchanting id:%s", id)
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -307,7 +308,8 @@ func (this *configureComp) getSellcoefficient(id int32) (result *cfg.GameSellCoe
|
||||
return
|
||||
} else {
|
||||
if result, ok = v.(*cfg.GameSellCoefficient).GetDataMap()[id]; !ok {
|
||||
err = fmt.Errorf("on found getSellcoefficient id:%d", id)
|
||||
err = comm.NewNotFoundConfErr(moduleName, equip_attrlibrary, id)
|
||||
// err = fmt.Errorf("on found getSellcoefficient id:%d", id)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ import (
|
||||
"github.com/go-redis/redis/v8"
|
||||
)
|
||||
|
||||
const moduleName = "装备"
|
||||
|
||||
/*
|
||||
模块名:装备
|
||||
描述:用户装备管理以及装备升级强化相关
|
||||
|
@ -15,7 +15,7 @@ func (this *apiComp) BuyPhysicalCheck(session comm.IUserSession, req *pb.ItemsBu
|
||||
return
|
||||
}
|
||||
|
||||
//出售道具
|
||||
//购买
|
||||
func (this *apiComp) BuyPhysical(session comm.IUserSession, req *pb.ItemsBuyPhysicalReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
||||
var (
|
||||
err error
|
||||
@ -25,15 +25,27 @@ func (this *apiComp) BuyPhysical(session comm.IUserSession, req *pb.ItemsBuyPhys
|
||||
sale []*cfg.Gameatn
|
||||
)
|
||||
if code = this.BuyPhysicalCheck(session, req); code != pb.ErrorCode_Success {
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: req.String(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if user, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: req.String(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if needs = this.module.ModuleTools.GetGlobalConf().PsBuy; needs == nil && len(needs) == 0 {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: comm.NewNotFoundConfErr(modelName, "global.json", "PsBuy").Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -43,6 +55,9 @@ func (this *apiComp) BuyPhysical(session comm.IUserSession, req *pb.ItemsBuyPhys
|
||||
|
||||
if req.Amount+uint32(user.Physicalbuynum) > uint32(len(needs)) {
|
||||
code = pb.ErrorCode_ItemsBuyPsUpperLimit
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,10 @@ func (this *apiComp) BuyUnifiedTicket(session comm.IUserSession, req *pb.ItemsBu
|
||||
info *pb.DBUserExpand
|
||||
)
|
||||
if code = this.BuyUnifiedTicketCheck(session, req); code != pb.ErrorCode_Success {
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: req.String(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if info, code = this.module.modelItems.buyTicket(session, req.BuyNum); code != pb.ErrorCode_Success {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package items
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
@ -14,7 +15,7 @@ func (this *apiComp) DecomposeCheck(session comm.IUserSession, req *pb.ItemsDeco
|
||||
return
|
||||
}
|
||||
|
||||
//出售道具
|
||||
//分解道具
|
||||
func (this *apiComp) Decompose(session comm.IUserSession, req *pb.ItemsDecomposeReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
||||
var (
|
||||
err error
|
||||
@ -27,18 +28,30 @@ func (this *apiComp) Decompose(session comm.IUserSession, req *pb.ItemsDecompose
|
||||
}
|
||||
if item, err = this.module.modelItems.QueryUserPackByGridId(session.GetUserId(), req.GridId); err != nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if itemcf, err = this.module.configure.GetItemConfigure(item.ItemId); err != nil {
|
||||
code = pb.ErrorCode_ConfigurationException
|
||||
return
|
||||
}
|
||||
if itemcf.Sale == nil || len(itemcf.Sale) == 0 {
|
||||
code = pb.ErrorCode_ItemsUseNoCanSell
|
||||
return
|
||||
}
|
||||
// if itemcf.Sale == nil || len(itemcf.Sale) == 0 {
|
||||
// code = pb.ErrorCode_ItemsUseNoCanSell
|
||||
// data = &pb.ErrorData{
|
||||
// Title: code.ToString(),
|
||||
// Message: fmt.Sprintf("道具未配置"),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
if itemcf.DecomposeDeplete == nil || len(itemcf.DecomposeDeplete) == 0 {
|
||||
code = pb.ErrorCode_ItemsUseNoCanSell
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: fmt.Sprintf("道具分解配置未配置! 道具id:%s", itemcf.Id),
|
||||
}
|
||||
return
|
||||
}
|
||||
sale = make([]*cfg.Gameatn, 0, len(itemcf.DecomposeDeplete))
|
||||
@ -54,8 +67,12 @@ func (this *apiComp) Decompose(session comm.IUserSession, req *pb.ItemsDecompose
|
||||
}
|
||||
|
||||
if req.Amount > item.Amount {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
this.module.Errorf("SellItemCheck over all amount:[%d:%d]", req.Amount, item.Amount)
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: fmt.Sprintf("道具数量不足! 道具数量:%s", item.Amount),
|
||||
}
|
||||
return
|
||||
}
|
||||
sale = make([]*cfg.Gameatn, len(itemcf.Sale))
|
||||
|
@ -37,6 +37,10 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ItemsGetlistReq)
|
||||
if items, err = this.module.modelItems.QueryUserPack(session.GetUserId()); err != nil {
|
||||
this.module.Errorf("QueryUserPackReq err:%v", err)
|
||||
code = pb.ErrorCode_CacheReadError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
} else {
|
||||
// tempgrids = this.module.configure.GetPackItemByType(items, req.IType)
|
||||
|
@ -22,6 +22,10 @@ func (this *apiComp) PotionSynthesis(session comm.IUserSession, req *pb.ItemsPot
|
||||
)
|
||||
if configure, err = this.module.configure.GetMaterialConfigure(req.Id); err != nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
need = make([]*cfg.Gameatn, len(configure.Material))
|
||||
|
@ -37,6 +37,10 @@ func (this *apiComp) Sellinbulk(session comm.IUserSession, req *pb.ItemsSellinbu
|
||||
}
|
||||
if itemcf, err = this.module.configure.GetItemConfigures(cids); err != nil {
|
||||
code = pb.ErrorCode_ConfigurationException
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
issucc = make([]bool, len(items))
|
||||
@ -68,12 +72,13 @@ func (this *apiComp) Sellinbulk(session comm.IUserSession, req *pb.ItemsSellinbu
|
||||
if err = this.module.modelItems.UpdateUserPack(session.GetUserId(), items...); err != nil {
|
||||
this.module.Errorln(err)
|
||||
code = pb.ErrorCode_DBError
|
||||
data = &pb.ErrorData{
|
||||
Title: code.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if err = this.module.itemsChangePush(session, items); err != nil {
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
this.module.itemsChangePush(session, items)
|
||||
session.SendMsg(string(this.module.GetType()), "sellitem", &pb.ItemsSellinbulkResp{Grids: req.Grids, Amount: req.Amount, Issucc: issucc})
|
||||
return
|
||||
}
|
||||
|
@ -12,6 +12,8 @@ import (
|
||||
"go_dreamfactory/lego/sys/event"
|
||||
)
|
||||
|
||||
const modelName = "道具背包"
|
||||
|
||||
/*
|
||||
模块名:Pack
|
||||
描述:背包系统模块
|
||||
|
Loading…
Reference in New Issue
Block a user