mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-03-01 00:35:36 +08:00
圣遗物装备卸下功能
This commit is contained in:
@@ -9,30 +9,30 @@ import (
|
||||
)
|
||||
|
||||
type Avatar struct {
|
||||
AvatarId uint32 // 角色id
|
||||
LifeState uint16 // 存活状态
|
||||
Level uint8 // 等级
|
||||
Exp uint32 // 经验值
|
||||
Promote uint8 // 突破等阶
|
||||
Satiation uint32 // 饱食度
|
||||
SatiationPenalty uint32 // 饱食度溢出
|
||||
CurrHP float64 // 当前生命值
|
||||
CurrEnergy float64 // 当前元素能量值
|
||||
FetterList []uint32 // 资料解锁条目
|
||||
SkillLevelMap map[uint32]uint32 // 技能等级数据
|
||||
SkillDepotId uint32 // 技能库id
|
||||
FlyCloak uint32 // 当前风之翼
|
||||
Costume uint32 // 当前衣装
|
||||
BornTime int64 // 获得时间
|
||||
FetterLevel uint8 // 好感度等级
|
||||
FetterExp uint32 // 好感度经验
|
||||
PromoteRewardMap map[uint32]bool // 突破奖励 map[突破等级]是否已被领取
|
||||
Guid uint64 `bson:"-" msgpack:"-"`
|
||||
EquipGuidMap map[uint64]uint64 `bson:"-" msgpack:"-"`
|
||||
EquipWeapon *Weapon `bson:"-" msgpack:"-"`
|
||||
EquipReliquaryList []*Reliquary `bson:"-" msgpack:"-"`
|
||||
FightPropMap map[uint32]float32 `bson:"-" msgpack:"-"`
|
||||
ExtraAbilityEmbryos map[string]bool `bson:"-" msgpack:"-"`
|
||||
AvatarId uint32 // 角色id
|
||||
LifeState uint16 // 存活状态
|
||||
Level uint8 // 等级
|
||||
Exp uint32 // 经验值
|
||||
Promote uint8 // 突破等阶
|
||||
Satiation uint32 // 饱食度
|
||||
SatiationPenalty uint32 // 饱食度溢出
|
||||
CurrHP float64 // 当前生命值
|
||||
CurrEnergy float64 // 当前元素能量值
|
||||
FetterList []uint32 // 资料解锁条目
|
||||
SkillLevelMap map[uint32]uint32 // 技能等级数据
|
||||
SkillDepotId uint32 // 技能库id
|
||||
FlyCloak uint32 // 当前风之翼
|
||||
Costume uint32 // 当前衣装
|
||||
BornTime int64 // 获得时间
|
||||
FetterLevel uint8 // 好感度等级
|
||||
FetterExp uint32 // 好感度经验
|
||||
PromoteRewardMap map[uint32]bool // 突破奖励 map[突破等级]是否已被领取
|
||||
Guid uint64 `bson:"-" msgpack:"-"`
|
||||
EquipGuidMap map[uint64]uint64 `bson:"-" msgpack:"-"`
|
||||
EquipWeapon *Weapon `bson:"-" msgpack:"-"`
|
||||
EquipReliquaryMap map[uint8]*Reliquary `bson:"-" msgpack:"-"`
|
||||
FightPropMap map[uint32]float32 `bson:"-" msgpack:"-"`
|
||||
ExtraAbilityEmbryos map[string]bool `bson:"-" msgpack:"-"`
|
||||
}
|
||||
|
||||
func (p *Player) InitAllAvatar() {
|
||||
@@ -129,7 +129,7 @@ func (p *Player) AddAvatar(avatarId uint32) {
|
||||
Guid: 0,
|
||||
EquipGuidMap: nil,
|
||||
EquipWeapon: nil,
|
||||
EquipReliquaryList: nil,
|
||||
EquipReliquaryMap: nil,
|
||||
FightPropMap: nil,
|
||||
ExtraAbilityEmbryos: make(map[string]bool),
|
||||
PromoteRewardMap: make(map[uint32]bool, len(avatarDataConfig.PromoteRewardMap)),
|
||||
@@ -183,6 +183,32 @@ func (p *Player) SetCurrEnergy(avatar *Avatar, value float64, max bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Player) WearReliquary(avatarId uint32, reliquaryId uint64) {
|
||||
avatar := p.AvatarMap[avatarId]
|
||||
reliquary := p.ReliquaryMap[reliquaryId]
|
||||
reliquaryConfig := gdconf.GetItemDataById(int32(reliquary.ItemId))
|
||||
if reliquaryConfig == nil {
|
||||
logger.Error("reliquary config error, itemId: %v", reliquary.ItemId)
|
||||
return
|
||||
}
|
||||
avatar.EquipReliquaryMap[uint8(reliquaryConfig.ReliquaryType)] = reliquary
|
||||
reliquary.AvatarId = avatarId
|
||||
avatar.EquipGuidMap[reliquary.Guid] = reliquary.Guid
|
||||
}
|
||||
|
||||
func (p *Player) TakeOffReliquary(avatarId uint32, reliquaryId uint64) {
|
||||
avatar := p.AvatarMap[avatarId]
|
||||
reliquary := p.ReliquaryMap[reliquaryId]
|
||||
reliquaryConfig := gdconf.GetItemDataById(int32(reliquary.ItemId))
|
||||
if reliquaryConfig == nil {
|
||||
logger.Error("reliquary config error, itemId: %v", reliquary.ItemId)
|
||||
return
|
||||
}
|
||||
delete(avatar.EquipReliquaryMap, uint8(reliquaryConfig.ReliquaryType))
|
||||
reliquary.AvatarId = 0
|
||||
delete(avatar.EquipGuidMap, reliquary.Guid)
|
||||
}
|
||||
|
||||
func (p *Player) WearWeapon(avatarId uint32, weaponId uint64) {
|
||||
avatar := p.AvatarMap[avatarId]
|
||||
weapon := p.WeaponMap[weaponId]
|
||||
|
||||
Reference in New Issue
Block a user