feat(xmlres): 优化配置加载与字段指针处理

- 将部分全局配置变量调整为局部加载,减少内存占用
- 修改 Item 结构体中 Nature 和 NatureSet 字段为指针类型,支持空值判断
- 更新使用点逻辑以适配指针字段,避免解析错误
- 移除未使用的配置引用及旧控制器文件
This commit is contained in:
2025-12-04 02:11:51 +08:00
parent 9c172d4ff7
commit 08b7553388
4 changed files with 17 additions and 18 deletions

View File

@@ -54,12 +54,12 @@ func (h Controller) ItemUsePet(data *item.C2S_USE_PET_ITEM_OUT_OF_FIGHT, c *play
case itemID >= 240042 && itemID <= 240056:
if xmlres.ItemsMAP[int(itemID)].Nature != 0 {
onpet.Nature = uint32(xmlres.ItemsMAP[int(itemID)].Nature)
if xmlres.ItemsMAP[int(itemID)].Nature != nil {
onpet.Nature = gconv.Uint32(*xmlres.ItemsMAP[int(itemID)].Nature)
}
if xmlres.ItemsMAP[int(itemID)].NatureSet != "" {
if xmlres.ItemsMAP[int(itemID)].NatureSet != nil {
rr := strings.Split(xmlres.ItemsMAP[int(itemID)].NatureSet, " ")
rr := strings.Split(*xmlres.ItemsMAP[int(itemID)].NatureSet, " ")
onpet.Nature = gconv.Uint32(rr[grand.Intn(len(rr))-1])
}
default: