111
This commit is contained in:
@@ -101,7 +101,11 @@ func Initfile() {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
PetMAP = utils.ToMap[PetInfo, int](getXml[Monsters](path+"226.xml").Monsters, func(m PetInfo) int {
|
pets := getXml[Monsters](path + "226.xml").Monsters
|
||||||
|
for i := range pets {
|
||||||
|
pets[i].YieldingEVValues = parseYieldingEV(pets[i].YieldingEV)
|
||||||
|
}
|
||||||
|
PetMAP = utils.ToMap[PetInfo, int](pets, func(m PetInfo) int {
|
||||||
return m.ID
|
return m.ID
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
package xmlres
|
package xmlres
|
||||||
|
|
||||||
import "github.com/ECUST-XX/xml"
|
import (
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/ECUST-XX/xml"
|
||||||
|
)
|
||||||
|
|
||||||
// Move 表示怪物可学习的技能
|
// Move 表示怪物可学习的技能
|
||||||
type PetMoves struct {
|
type PetMoves struct {
|
||||||
@@ -45,6 +50,7 @@ type PetInfo struct {
|
|||||||
Recycle int `xml:"Recycle,attr"` // 是否可回收
|
Recycle int `xml:"Recycle,attr"` // 是否可回收
|
||||||
LearnableMoves LearnableMoves `xml:"LearnableMoves"` // 可学习的技能
|
LearnableMoves LearnableMoves `xml:"LearnableMoves"` // 可学习的技能
|
||||||
NaturalEnemy string `xml:"NaturalEnemy,attr"` //天敌
|
NaturalEnemy string `xml:"NaturalEnemy,attr"` //天敌
|
||||||
|
YieldingEVValues []int64 `xml:"-"` // 预解析后的努力值奖励
|
||||||
}
|
}
|
||||||
|
|
||||||
func (basic *PetInfo) GetBasic() uint32 {
|
func (basic *PetInfo) GetBasic() uint32 {
|
||||||
@@ -61,3 +67,16 @@ type Monsters struct {
|
|||||||
XMLName xml.Name `xml:"Monsters"`
|
XMLName xml.Name `xml:"Monsters"`
|
||||||
Monsters []PetInfo `xml:"Monster"`
|
Monsters []PetInfo `xml:"Monster"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func parseYieldingEV(raw string) []int64 {
|
||||||
|
values := make([]int64, 6)
|
||||||
|
parts := strings.Fields(raw)
|
||||||
|
for i := 0; i < len(parts) && i < len(values); i++ {
|
||||||
|
value, err := strconv.ParseInt(parts[i], 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
values[i] = value
|
||||||
|
}
|
||||||
|
return values
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"blazing/common/data"
|
"blazing/common/data"
|
||||||
"blazing/common/data/xmlres"
|
"blazing/common/data/xmlres"
|
||||||
"blazing/common/socket/errorcode"
|
"blazing/common/socket/errorcode"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"blazing/logic/service/fight"
|
"blazing/logic/service/fight"
|
||||||
fightinfo "blazing/logic/service/fight/info"
|
fightinfo "blazing/logic/service/fight/info"
|
||||||
@@ -279,5 +278,5 @@ func handleNpcFightRewards(p *player.Player, foi model.FightOverInfo, monster *m
|
|||||||
if rewards.HasReward() {
|
if rewards.HasReward() {
|
||||||
p.SendPackCmd(8004, rewards)
|
p.SendPackCmd(8004, rewards)
|
||||||
}
|
}
|
||||||
foi.Winpet.AddEV(gconv.Int64s(strings.Fields(petCfg.YieldingEV)))
|
foi.Winpet.AddEV(petCfg.YieldingEVValues)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user