```
feat(game): 实现扭蛋系统批量物品添加功能并优化地图逻辑 - 新增ItemAddBatch方法用于批量添加物品,支持普通道具和特殊道具的分别处理 - 优化扭蛋游戏玩法中的物品添加逻辑,使用新的批量接口提升性能 - 在扭蛋机器人命令中实现完整的物品检查和批量添加流程 refactor(map): 重构地图控制器代码结构并添加注释 - 为EnterMap、LeaveMap、GetMapPlayerList等方法添加中文注释 - 统一地图相关的命名规范,如enter map替换进入地图 - 调整地图玩家列表中BOSS广播命令ID,2021和2022进行对调 refactor(boss): 重构定时BOSS代码并优化注释 - 将原有的中文注释改为英文注释,统一代码风格 - 简化TimeBossRule结构体定义和相关配置 - 优化定时任务注册逻辑,去除冗余的注释和变量 refactor(space): 清理地图空间服务代码注释 - 移除多余的中文注释和说明文字 - 统一代码格式,移除不必要的空行和注释 - 保持原有的天气系统和地图刷怪逻辑不变 fix(role): 修复系统角色权限查询逻辑 - 修改BaseSysRoleService中的查询条件,正确处理管理员权限 - 使用Extend方法替代Where进行复杂的权限判断逻辑 - 确保超级管理员可以访问所有角色,其他用户受限于权限范围 refactor(dict): 添加字典服务批量查询方法 - 新增GetMaxMap方法用于批量获取物品最大持有上限 - 优化数据库查询,减少多次单个查询的开销 - 支持一次请求多个物品的最大数量限制 fix(player): 修复玩家信息保存异常处理 - 将panic方式改为错误日志记录,避免程序崩溃 - 优化Save方法的重试逻辑,统一错误处理方式 - 在本地文件回退时记录详细错误信息 feat(robot): 扩展扭蛋机器人功能 - 添加用户验证和角色创建检查 - 实现批量扭蛋的完整逻辑,支持1-10次抽取 - 集成物品数量检查和批量添加功能 ```
This commit is contained in:
@@ -26,31 +26,22 @@ const (
|
||||
MapModelDirectionRightUp
|
||||
)
|
||||
|
||||
// MapModelBroadcastNode 地图模型广播节点配置
|
||||
type MapModelBroadcastNode struct {
|
||||
TriggerID uint32 `gorm:"comment:'触发器ID'" json:"trigger_id" description:"触发器ID"`
|
||||
Pos string `gorm:"type:varchar(255);default:'';comment:'位置'" json:"pos" description:"位置"`
|
||||
HP int32 `gorm:"type:int;default:0;comment:'血量'" json:"hp" description:"血量"`
|
||||
Direction int32 `gorm:"type:int;default:2;comment:'BOSS方向(0-7)'" json:"direction" description:"BOSS方向"`
|
||||
}
|
||||
|
||||
// MapModel 地图模型配置表(NPC/宠物)
|
||||
type MapModel struct {
|
||||
*cool.Model // 保留通用Model(ID/创建时间/更新时间等)
|
||||
*MapModelBroadcastNode
|
||||
|
||||
MapID int32 `gorm:"not null;index;comment:'所属地图ID'" json:"map_id" description:"地图ID"`
|
||||
|
||||
NodeID uint32 `gorm:"not null;default:0;comment:'节点ID'" json:"node_id" description:"节点ID"`
|
||||
|
||||
ModelID uint32 `gorm:"not null;default:0;comment:'模型ID(NPCID或精灵ID)'" json:"model_id" description:"模型ID"`
|
||||
|
||||
ModelType int32 `gorm:"type:int;default:0;comment:'模型类型(0:精灵,1:NPC)'" json:"model_type" description:"模型类型"`
|
||||
|
||||
ModelName string `gorm:"type:varchar(100);default:'';comment:'模型名称'" json:"model_name" description:"模型名称"`
|
||||
|
||||
HeadTalk string `gorm:"type:varchar(255);default:'';comment:'头顶对话框内容'" json:"head_talk" description:"头顶对话框内容"`
|
||||
|
||||
HeadTalk string `gorm:"type:varchar(255);default:'';comment:'头顶对话框内容'" json:"head_talk" description:"头顶对话框内容"`
|
||||
Pos string `gorm:"type:varchar(255);default:'';comment:'位置'" json:"pos" description:"位置"`
|
||||
HP int32 `gorm:"type:int;default:0;comment:'血量'" json:"hp" description:"血量"`
|
||||
Direction int32 `gorm:"type:int;default:2;comment:'方向(0-7)'" json:"direction" description:"BOSS方向"`
|
||||
TriggerPlotID uint32 `gorm:"default:0;comment:'触发剧情ID(0表示无剧情)'" json:"trigger_plot_id" description:"触发剧情ID"`
|
||||
Cloths []uint32 `gorm:"type:varchar(255);default:'';comment:'服装'" json:"cloths" description:"服装"`
|
||||
Shinyid int32 `gorm:"type:int;default:0;comment:'是否发光'" json:"shiny" description:"是否发光"`
|
||||
@@ -66,8 +57,7 @@ func (*MapModel) GroupName() string {
|
||||
|
||||
func NewMapModel() *MapModel {
|
||||
return &MapModel{
|
||||
Model: cool.NewModel(),
|
||||
MapModelBroadcastNode: &MapModelBroadcastNode{},
|
||||
Model: cool.NewModel(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,6 @@ func (s *MapmodelService) ServiceList(ctx context.Context, req *cool.ListReq) (d
|
||||
}
|
||||
|
||||
func (s *MapmodelService) GetDataByModelId(modelid uint32) (ret *model.MapModel) {
|
||||
dbm_notenable(s.Model).Where("model_id", modelid).Scan(&ret)
|
||||
dbm_notenable(s.Model).Where("id", modelid).Scan(&ret)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -54,8 +54,9 @@ func (p *PeopleItemInfo) InitDefaults() {
|
||||
func NewPlayerInfo() PlayerInfo {
|
||||
l := PlayerInfo{
|
||||
|
||||
Clothes: make([]PeopleItemInfo, 0),
|
||||
PetList: make([]PetInfo, 0),
|
||||
Clothes: make([]PeopleItemInfo, 0),
|
||||
PetList: make([]PetInfo, 0),
|
||||
BackupPetList: make([]PetInfo, 0),
|
||||
}
|
||||
|
||||
// 自动填充 struct tag 里的 default 值
|
||||
@@ -198,16 +199,17 @@ type PlayerInfo struct {
|
||||
Nick string `struc:"[16]byte" default:"nono" json:"nono_nick"` // nono名字(16字节)
|
||||
}
|
||||
|
||||
TeamInfo TeamInfo `struc:"struct" json:"team_info"` // 战队信息24字节
|
||||
TeamPkInfo TeamPKInfo `struc:"struct" json:"team_pk_info"` // 8字节
|
||||
Reserved byte `struc:"byte" json:"reserved"` // 1字节无内容
|
||||
Badge uint32 `struc:"uint32" default:"0" json:"badge"` // 默认0
|
||||
Reserved1 [27]byte `struc:"[27]byte" default:"3" json:"reserved1"` // 27字节默认3
|
||||
TaskList [1000]byte `struc:"[1000]byte" default:"0" json:"task_list"` // 任务状态数组500字节,默认3
|
||||
PetListCount uint32 `struc:"sizeof=PetList" json:"pet_list_count"` // 精灵列表长度
|
||||
PetList []PetInfo ` json:"pet_list"` // 精灵背包内信息
|
||||
ClothesCount uint32 `struc:"sizeof=Clothes" json:"clothes_count"` // 穿戴装备数量
|
||||
Clothes []PeopleItemInfo ` json:"clothes"` // 穿戴装备
|
||||
TeamInfo TeamInfo `struc:"struct" json:"team_info"` // 战队信息24字节
|
||||
TeamPkInfo TeamPKInfo `struc:"struct" json:"team_pk_info"` // 8字节
|
||||
Reserved byte `struc:"byte" json:"reserved"` // 1字节无内容
|
||||
Badge uint32 `struc:"uint32" default:"0" json:"badge"` // 默认0
|
||||
Reserved1 [27]byte `struc:"[27]byte" default:"3" json:"reserved1"` // 27字节默认3
|
||||
TaskList [1000]byte `struc:"[1000]byte" default:"0" json:"task_list"` // 任务状态数组500字节,默认3
|
||||
PetListCount uint32 `struc:"sizeof=PetList" json:"pet_list_count"` // 精灵列表长度
|
||||
PetList []PetInfo ` json:"pet_list"` // 精灵背包内信息
|
||||
BackupPetList []PetInfo `struc:"skip" json:"backup_pet_list"` // 精灵并列备用列表
|
||||
ClothesCount uint32 `struc:"sizeof=Clothes" json:"clothes_count"` // 穿戴装备数量
|
||||
Clothes []PeopleItemInfo ` json:"clothes"` // 穿戴装备
|
||||
}
|
||||
|
||||
// trace("个人装扮是否半价:",MainManager.isClothHalfDay);
|
||||
|
||||
@@ -65,6 +65,13 @@ func (s *InfoService) GetLogin() *model.PlayerInfo {
|
||||
return nil
|
||||
}
|
||||
tt.Data.AllPetNumber = uint32(NewPetService(s.userid).PetCount(0))
|
||||
if len(tt.Data.BackupPetList) == 0 {
|
||||
storagePets := NewPetService(s.userid).PetInfo(1)
|
||||
tt.Data.BackupPetList = make([]model.PetInfo, len(storagePets))
|
||||
for i := range storagePets {
|
||||
tt.Data.BackupPetList[i] = storagePets[i].Data
|
||||
}
|
||||
}
|
||||
|
||||
if tt.Data.MapID > 300 || tt.Data.MapID == 0 { //如果位于基地,就重置到传送仓
|
||||
tt.Data.MapID = 1
|
||||
|
||||
Reference in New Issue
Block a user