161 lines
5.7 KiB
Go
161 lines
5.7 KiB
Go
package comm
|
|
|
|
import (
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
/*
|
|
业务模块 对外接口定义处
|
|
*/
|
|
|
|
type (
|
|
ModuleCallSource struct {
|
|
Module string //来源模块
|
|
FuncName string //来源方法
|
|
Describe string //调用描述
|
|
}
|
|
|
|
ISys interface {
|
|
IsAccess(funcName string, userLv int32) bool
|
|
}
|
|
|
|
//邮件业务模块对外接口定义 提供给其他模块使用的
|
|
Imail interface {
|
|
CreateNewMail(session IUserSession, mail *pb.DBMailData) bool
|
|
}
|
|
//道具背包接口
|
|
IItems interface {
|
|
//查询用户背包物品数量
|
|
QueryItemAmount(source *ModuleCallSource, uId string, itemid string) (amount uint32)
|
|
//查询用户背包多个物品数量
|
|
QueryItemsAmount(source *ModuleCallSource, uId string, itemid ...string) (result map[string]uint32)
|
|
///添加单个物品到背包 (可以加物品和减物品)
|
|
AddItem(source *ModuleCallSource, session IUserSession, itemid string, addnum int32, bPush bool) (code pb.ErrorCode)
|
|
///添加多个物品到背包 (可以加物品和减物品)
|
|
AddItems(source *ModuleCallSource, session IUserSession, items map[string]int32, bPush bool) (code pb.ErrorCode)
|
|
}
|
|
|
|
//英雄
|
|
IHero interface {
|
|
//查询用户卡片数量
|
|
QueryHeroAmount(uId string, heroCfgId string) (amount uint32)
|
|
//创建新英雄
|
|
CreateHeroes(uid string, heroCfgId ...string) error
|
|
//创建指定数量
|
|
CreateRepeatHero(session IUserSession, heroCfgId string, num int32, bPush bool) (code pb.ErrorCode)
|
|
// 批量创建英雄
|
|
CreateRepeatHeros(session IUserSession, heros map[string]int32, bPush bool) (code pb.ErrorCode)
|
|
// 获取英雄
|
|
// heroId 英雄ID
|
|
GetHeroByObjID(uid, heroId string) (*pb.DBHero, pb.ErrorCode)
|
|
// 佩戴装备
|
|
UpdateEquipment(session IUserSession, hero *pb.DBHero, equip []*pb.DB_Equipment) (code pb.ErrorCode)
|
|
//获取玩家英雄列表
|
|
GetHeroList(uid string) []*pb.DBHero
|
|
//清理玩家英雄数据
|
|
CleanData(uid string)
|
|
// 获取指定星级等级的英雄
|
|
GetSpecifiedHero(session IUserSession, heroConfId string, star, lv, amount int32) (code pb.ErrorCode)
|
|
// 英雄加经验
|
|
AddHeroExp(session IUserSession, heroObjID string, exp int32) (code pb.ErrorCode)
|
|
// 英雄练功
|
|
KungFuHero(session IUserSession, heroObjID string, bKongfu bool) (code pb.ErrorCode)
|
|
|
|
//Create Monster
|
|
CreateMonster(heroCid string, star, lv int32) (hero *pb.DBHero)
|
|
}
|
|
|
|
//玩家
|
|
IUser interface {
|
|
//获取用户数据
|
|
GetUser(uid string) *pb.DBUser
|
|
//获取用户回话
|
|
GetUserSession(uid string) *pb.CacheUser
|
|
//查询用户属性值 例如 金币 经验
|
|
QueryAttributeValue(uid string, attr string) (value int32)
|
|
//添加/减少属性值 第四个参数控制是否推送给前端
|
|
AddAttributeValue(session IUserSession, attr string, add int32, bPush bool) (code pb.ErrorCode)
|
|
// 批量处理
|
|
AddAttributeValues(session IUserSession, attrs map[string]int32, bPush bool) (code pb.ErrorCode)
|
|
//用户改变事件
|
|
EventUserChanged(session IUserSession)
|
|
//获取用户expand
|
|
GetUserExpand(uid string) (result *pb.DBUserExpand, err error)
|
|
//更新用户expand
|
|
ChangeUserExpand(uid string, value map[string]interface{}) error
|
|
// 本服在线玩家列表
|
|
UserOnlineList() ([]*pb.CacheUser, error)
|
|
}
|
|
//武器模块
|
|
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 string) (amount uint32)
|
|
//添加新武器
|
|
AddNewEquipments(source *ModuleCallSource, session IUserSession, cIds map[string]uint32, bPush bool) (code pb.ErrorCode)
|
|
}
|
|
IMainline interface {
|
|
// 修改章节信息
|
|
ModifyMainlineData(uid string, objId string, data interface{}) (code pb.ErrorCode)
|
|
/// 查询章节ID
|
|
GetUsermainLineData(uid string) (mainlineId int32)
|
|
}
|
|
//任务
|
|
ITask interface {
|
|
//初始化 日常/周常/成就
|
|
InitTaskAll(uid string)
|
|
// 初始化指定的任务
|
|
InitTaskByTag(uid string, taskTag TaskTag)
|
|
//清空任务
|
|
ResetTask(uid string, taskTag TaskTag)
|
|
//任务通知
|
|
SendToTask(session IUserSession, taskType TaskType, param *pb.TaskParam) (code pb.ErrorCode)
|
|
// 清理玩家任务数据
|
|
CleanData(uid string)
|
|
// 获取当前任务
|
|
GetTaskById(uid string, taskId int32) *pb.DBTask
|
|
// 获取已完成的任务列表
|
|
GetTaskFinished(uid string, taskType TaskTag) []*pb.DBTask
|
|
}
|
|
|
|
// 随机任务
|
|
IRtask interface {
|
|
CheckCondi(session IUserSession, condiId int32) (code pb.ErrorCode)
|
|
//任务触发
|
|
SendToRtask(session IUserSession, rtaskType TaskType, params ...int32) (code pb.ErrorCode)
|
|
}
|
|
|
|
//好友
|
|
IFriend interface {
|
|
// 重置点赞列表和每日友情点
|
|
ResetFriend(uid string)
|
|
// 获取好友数量
|
|
GetFriendCount(uid string) int32
|
|
// 获取好友列表
|
|
GetFriendList(uid string) []string
|
|
}
|
|
|
|
//聊天系统
|
|
IChat interface {
|
|
//推送消息到世界频道
|
|
SendWorldChat(msg *pb.DBChat) (code pb.ErrorCode)
|
|
//推送消息到用户
|
|
SendUserChat(msg *pb.DBChat) (code pb.ErrorCode)
|
|
//广播系统消息
|
|
SendSysChatToWorld(ctype ChatSystemType, appenddata interface{}, value int32, agrs ...interface{}) (code pb.ErrorCode)
|
|
//广播系统消息
|
|
SendSysChatToUser(session IUserSession, ctype ChatSystemType, value int32, agrs ...interface{}) (code pb.ErrorCode)
|
|
}
|
|
|
|
//战斗系统
|
|
IBattle interface {
|
|
///创建pve战斗
|
|
CreatePveBattle(session IUserSession, req *pb.BattlePVEReq) (code pb.ErrorCode, record *pb.DBBattleRecord)
|
|
///创建pvb战斗
|
|
CreatePvbBattle(session IUserSession, req *pb.BattlePVEReq) (code pb.ErrorCode, record *pb.DBBattleRecord)
|
|
//校验战报
|
|
CheckBattleReport(session IUserSession, report *pb.BattleReport) (code pb.ErrorCode, iswin bool)
|
|
}
|
|
)
|