refactor: 更新资产路径和依赖

- 修改资产路径:从 'common/data/xml/assets/**' 改为 'public/assets/**'
- 更新 go.mod 文件,添加新依赖:
  - github.com/cespare/xxhash/v2
  - github.com/dgryski/go-rendezvous
  - github.com/go-redis/redis/v8
  - github.com/yitter/idgenerator-go
- 删除 assets 目录下的 XML 文件
This commit is contained in:
2025-08-15 19:24:02 +08:00
parent de5ee07a22
commit dd76919578
38 changed files with 263 additions and 87487 deletions

View File

@@ -1,9 +1,5 @@
package model
import (
"github.com/creasty/defaults"
)
type Pos struct {
X uint32 `struc:"uint32" default:"0"`
Y uint32 `struc:"uint32" default:"0"`
@@ -22,13 +18,6 @@ func (p *PeopleItemInfo) InitDefaults() {
type PlayerLoginInfo struct {
GoldBean int32 `struc:"skip" json:"nieo_gold_bean"` // 金豆(特殊货币)
// EquipmentHead int32 `struc:"skip" json:"equipment_head"` // 头部穿戴装备ID(0=未穿戴)
// EquipmentFace int32 `struc:"skip" json:"equipment_face"` // 脸部穿戴装备ID
// EquipmentHand int32 `struc:"skip" json:"equipment_hand"` // 手部穿戴装备ID
// EquipmentWaist int32 `struc:"skip" json:"equipment_waist"` // 腰部穿戴装备ID
// EquipmentLeg int32 `struc:"skip" json:"equipment_leg"` // 腿部穿戴装备ID
// EquipmentBackground int32 `struc:"skip" json:"equipment_background"` // 背景穿戴装备ID
// RobotColor int64 `struc:"skip" json:"robot_color"` // RGB颜色值(uint32,实际为3个uint8)
ExpPool int64 `struc:"skip" json:"exp_pool"` // 累计经验池
@@ -103,40 +92,3 @@ type PlayerLoginInfo struct {
ClothesCount uint32 `struc:"sizeof=Clothes" json:"clothes_count"` // 穿戴装备数量
Clothes []PeopleItemInfo ` json:"clothes"` // 穿戴装备
}
func NewPlayerLoginInfo() *PlayerLoginInfo {
l := &PlayerLoginInfo{
Clothes: make([]PeopleItemInfo, 0),
PetList: make([]PetInfo, 0),
}
// 自动填充 struct tag 里的 default 值
if err := defaults.Set(l); err != nil {
panic(err) // 方便发现 default 设置错误
}
// 填充需要重复值的数组
fillBytes(&l.DailyResArr, 3)
fillBytes(&l.Reserved1, 3)
fillBytes(&l.TaskList, 3)
return l
}
// 工具函数:给数组/切片批量赋同一个 byte 值
func fillBytes(arr any, val byte) {
switch a := arr.(type) {
case *[50]byte:
for i := range a {
a[i] = val
}
case *[27]byte:
for i := range a {
a[i] = val
}
case *[500]byte:
for i := range a {
a[i] = val
}
}
}