87 lines
2.9 KiB
Go
87 lines
2.9 KiB
Go
package comm
|
|
|
|
import (
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
/*
|
|
业务模块 对外接口定义处
|
|
*/
|
|
|
|
type (
|
|
ModuleCallSource struct {
|
|
Module string //来源模块
|
|
FuncName string //来源方法
|
|
Describe string //调用描述
|
|
}
|
|
|
|
//邮件业务模块对外接口定义 提供给其他模块使用的
|
|
Imail interface {
|
|
CreateNewMail(uId string, mail *pb.DBMailData) bool
|
|
}
|
|
//道具背包接口
|
|
IItems interface {
|
|
//查询用户背包物品数量
|
|
QueryItemAmount(source *ModuleCallSource, uId string, itemid int32) (amount uint32)
|
|
//查询用户背包多个物品数量
|
|
QueryItemsAmount(source *ModuleCallSource, uId string, itemid ...int32) (result map[int32]uint32)
|
|
///添加单个物品到背包 (可以加物品和减物品)
|
|
AddItem(source *ModuleCallSource, uId string, itemid, addnum int32, bPush bool) (code pb.ErrorCode)
|
|
///添加多个物品到背包 (可以加物品和减物品)
|
|
AddItems(source *ModuleCallSource, uId string, items map[int32]int32, bPush bool) (code pb.ErrorCode)
|
|
}
|
|
|
|
//英雄
|
|
IHero interface {
|
|
//查询用户卡片数量
|
|
QueryHeroAmount(uId string, heroCfgId int32) (amount uint32)
|
|
//创建新英雄
|
|
CreateHero(uid string, bPush bool, heroCfgId ...int32) error
|
|
// 获取英雄
|
|
// heroId 英雄ID
|
|
GetHero(uid, heroId string) (*pb.DBHero, pb.ErrorCode)
|
|
// 佩戴装备
|
|
UpdateEquipment(hero *pb.DBHero, equip []*pb.DB_Equipment) (code pb.ErrorCode)
|
|
//获取玩家英雄列表
|
|
GetHeroList(uid string) []*pb.DBHero
|
|
}
|
|
|
|
//玩家
|
|
IUser interface {
|
|
//获取用户数据
|
|
GetUser(uid string) *pb.DBUser
|
|
//获取用户回话
|
|
GetUserSession(uid string) *pb.CacheUser
|
|
//查询用户属性值 例如 金币 经验
|
|
QueryAttributeValue(uid string, attr string) (value int32)
|
|
//添加/减少属性值 第四个参数控制是否推送给前端
|
|
AddAttributeValue(uid string, attr string, add int32, bPush bool) (code pb.ErrorCode)
|
|
}
|
|
//武器模块
|
|
IEquipment interface {
|
|
//查询服务资源数量 db id
|
|
QueryEquipment(source *ModuleCallSource, uid string, Id string) (equipment *pb.DB_Equipment, code pb.ErrorCode)
|
|
//查询服务资源数量 参数武器配置id
|
|
QueryEquipmentAmount(source *ModuleCallSource, uid string, equipmentId int32) (amount uint32)
|
|
//添加新武器
|
|
AddNewEquipments(source *ModuleCallSource, uid string, cIds map[int32]uint32, bPush bool) (code pb.ErrorCode)
|
|
}
|
|
IStory interface {
|
|
// 修改章节信息
|
|
ModifyStoryData(uid string, objId string, data interface{}) (code pb.ErrorCode)
|
|
// 检查能不能挑战该关卡
|
|
CheckChallengeChapter(stroyId int32, uid string, zhangjieID int32) (code pb.ErrorCode)
|
|
}
|
|
//任务
|
|
ITask interface {
|
|
//初始化用户任务
|
|
InitTask(uid string, taskTag TaskTag)
|
|
//初始化 日常/周常/成就
|
|
InitTaskAll(uid string)
|
|
//清空任务
|
|
ResetTask(uid string, taskTag TaskTag)
|
|
//任务通知
|
|
SendToTask(uid string, taskType TaskType, param *pb.TaskParam) (code pb.ErrorCode)
|
|
}
|
|
)
|