refactor(socket): 重构 ClientData 结构体并优化相关逻辑
- 简化 ClientData 结构体,移除不必要的方法 - 优化 Player 结构体,调整 Conn 类型 - 更新 wscodec.go 中的 Conn 结构体 - 删除未使用的 XML 相关文件和代码 - 调整 ServerEvent 和 controller 中的相关逻辑
This commit is contained in:
53
common/data/xmlres/item.go
Normal file
53
common/data/xmlres/item.go
Normal file
@@ -0,0 +1,53 @@
|
||||
package xmlres
|
||||
|
||||
import (
|
||||
"github.com/ECUST-XX/xml" // 保持与之前一致的XML库
|
||||
)
|
||||
|
||||
// Items 根节点,对应<Items>标签
|
||||
type Items struct {
|
||||
XMLName xml.Name `xml:"Items"`
|
||||
Items []Item `xml:"Item"` // 包含所有物品配置
|
||||
}
|
||||
|
||||
// Item 单个物品配置,对应<Item>标签
|
||||
type Item struct {
|
||||
ID int `xml:"ID,attr"` // 物品ID(与items.xml一致)
|
||||
Name string `xml:"Name,attr"` // 物品名称
|
||||
Rarity int `xml:"Rarity,attr,omitempty"` // 稀有度(可选)
|
||||
Price int `xml:"Price,attr"` // 价格
|
||||
Tradability int `xml:"Tradability,attr"` // 可交易性(0/1)
|
||||
VipTradability int `xml:"VipTradability,attr"` // VIP可交易性(0/1)
|
||||
DailyKey int `xml:"DailyKey,attr,omitempty"` // 每日限制键值(可选)
|
||||
DailyOutMax int `xml:"DailyOutMax,attr,omitempty"` // 每日最大产出(可选)
|
||||
Wd int `xml:"wd,attr"` // 未知属性(根据原XML保留)
|
||||
UseMax int `xml:"UseMax,attr"` // 最大使用次数
|
||||
LifeTime int `xml:"LifeTime,attr"` // 生命周期(0为永久)
|
||||
Purpose int `xml:"purpose,attr"` // 用途标识
|
||||
Bean int `xml:"Bean,attr,omitempty"` // 豆子数量(可选)
|
||||
Hide int `xml:"Hide,attr"` // 是否隐藏(0/1)
|
||||
Sort int `xml:"Sort,attr,omitempty"` // 排序序号(可选)
|
||||
Des string `xml:"des,attr"` // 物品用途(根据说明补充)
|
||||
Color string `xml:"color,attr,omitempty"` // 装备名字颜色(可选)
|
||||
Level int `xml:"level,attr,omitempty"` // 装备等级(星星,可选)
|
||||
|
||||
Pet *Pet `xml:"pet,omitempty"` // 精灵属性子节点(可选)
|
||||
TeamPK *TeamPK `xml:"teamPK,omitempty"` // 要塞保卫战子节点(可选)
|
||||
}
|
||||
|
||||
// Pet 精灵属性子节点,对应<pet>标签
|
||||
// 注:根据实际需求补充字段,这里以常见属性为例
|
||||
type Pet struct {
|
||||
Attack int `xml:"attack,attr,omitempty"` // 攻击加成
|
||||
Defense int `xml:"defense,attr,omitempty"` // 防御加成
|
||||
HP int `xml:"hp,attr,omitempty"` // 生命值加成
|
||||
Speed int `xml:"speed,attr,omitempty"` // 速度加成
|
||||
}
|
||||
|
||||
// TeamPK 要塞保卫战子节点,对应<teamPK>标签
|
||||
// 注:根据实际需求补充字段,这里以常见属性为例
|
||||
type TeamPK struct {
|
||||
FortBonus int `xml:"fortBonus,attr,omitempty"` // 要塞加成
|
||||
DefenseBonus int `xml:"defenseBonus,attr,omitempty"` // 防御加成
|
||||
AttackBonus int `xml:"attackBonus,attr,omitempty"` // 攻击加成
|
||||
}
|
||||
Reference in New Issue
Block a user