mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-13 00:52:26 +08:00
迁移配置表
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"time"
|
||||
|
||||
"hk4e/common/constant"
|
||||
gdc "hk4e/gs/config"
|
||||
"hk4e/gdconf"
|
||||
"hk4e/pkg/logger"
|
||||
)
|
||||
|
||||
@@ -19,20 +19,13 @@ type Avatar struct {
|
||||
CurrHP float64 `bson:"currHP"` // 当前生命值
|
||||
CurrEnergy float64 `bson:"currEnergy"` // 当前元素能量值
|
||||
FetterList []uint32 `bson:"fetterList"` // 资料解锁条目
|
||||
SkillLevelMap map[uint32]uint32 `bson:"skillLevelMap"` // 技能等级
|
||||
SkillExtraChargeMap map[uint32]uint32 `bson:"skillExtraChargeMap"`
|
||||
ProudSkillBonusMap map[uint32]uint32 `bson:"proudSkillBonusMap"`
|
||||
SkillDepotId uint32 `bson:"skillDepotId"`
|
||||
CoreProudSkillLevel uint8 `bson:"coreProudSkillLevel"` // 已解锁命之座层数
|
||||
TalentIdList []uint32 `bson:"talentIdList"` // 已解锁命之座技能列表
|
||||
ProudSkillList []uint32 `bson:"proudSkillList"` // 被动技能列表
|
||||
FlyCloak uint32 `bson:"flyCloak"` // 当前风之翼
|
||||
Costume uint32 `bson:"costume"` // 当前衣装
|
||||
BornTime int64 `bson:"bornTime"` // 获得时间
|
||||
FetterLevel uint8 `bson:"fetterLevel"` // 好感度等级
|
||||
FetterExp uint32 `bson:"fetterExp"` // 好感度经验
|
||||
NameCardRewardId uint32 `bson:"nameCardRewardId"`
|
||||
NameCardId uint32 `bson:"nameCardId"`
|
||||
SkillLevelMap map[uint32]uint32 `bson:"skillLevelMap"` // 技能等级数据
|
||||
SkillDepotId uint32 `bson:"skillDepotId"` // 技能库id
|
||||
FlyCloak uint32 `bson:"flyCloak"` // 当前风之翼
|
||||
Costume uint32 `bson:"costume"` // 当前衣装
|
||||
BornTime int64 `bson:"bornTime"` // 获得时间
|
||||
FetterLevel uint8 `bson:"fetterLevel"` // 好感度等级
|
||||
FetterExp uint32 `bson:"fetterExp"` // 好感度经验
|
||||
Guid uint64 `bson:"-"`
|
||||
EquipGuidList map[uint64]uint64 `bson:"-"`
|
||||
EquipWeapon *Weapon `bson:"-"`
|
||||
@@ -48,7 +41,7 @@ func (p *Player) InitAllAvatar() {
|
||||
}
|
||||
|
||||
func (p *Player) InitAvatar(avatar *Avatar) {
|
||||
avatarDataConfig, ok := gdc.CONF.AvatarDataMap[int32(avatar.AvatarId)]
|
||||
avatarDataConfig, ok := gdconf.CONF.AvatarDataMap[int32(avatar.AvatarId)]
|
||||
if !ok {
|
||||
logger.Error("avatarDataConfig error, avatarId: %v", avatar.AvatarId)
|
||||
return
|
||||
@@ -90,13 +83,13 @@ func (p *Player) GetAvatarIdByGuid(guid uint64) uint32 {
|
||||
}
|
||||
|
||||
func (p *Player) AddAvatar(avatarId uint32) {
|
||||
avatarDataConfig, ok := gdc.CONF.AvatarDataMap[int32(avatarId)]
|
||||
if !ok {
|
||||
logger.Error("avatarDataConfig error, avatarId: %v", avatarId)
|
||||
avatarDataConfig, exist := gdconf.CONF.AvatarDataMap[int32(avatarId)]
|
||||
if !exist {
|
||||
logger.Error("avatar data config is nil, avatarId: %v", avatarId)
|
||||
return
|
||||
}
|
||||
skillDepotId := int32(0)
|
||||
// 主角要单独设置
|
||||
// 主角可以切换属性 技能库要单独设置 这里默认给风元素的技能库
|
||||
if avatarId == 10000005 {
|
||||
skillDepotId = 504
|
||||
} else if avatarId == 10000007 {
|
||||
@@ -104,9 +97,9 @@ func (p *Player) AddAvatar(avatarId uint32) {
|
||||
} else {
|
||||
skillDepotId = avatarDataConfig.SkillDepotId
|
||||
}
|
||||
avatarSkillDepotDataConfig, ok := gdc.CONF.AvatarSkillDepotDataMap[skillDepotId]
|
||||
if !ok {
|
||||
logger.Error("avatarSkillDepotDataConfig error, skillDepotId: %v", skillDepotId)
|
||||
avatarSkillDepotDataConfig, exist := gdconf.CONF.AvatarSkillDepotDataMap[skillDepotId]
|
||||
if !exist {
|
||||
logger.Error("avatar skill depot data config is nil, skillDepotId: %v", skillDepotId)
|
||||
return
|
||||
}
|
||||
avatar := &Avatar{
|
||||
@@ -119,46 +112,27 @@ func (p *Player) AddAvatar(avatarId uint32) {
|
||||
SatiationPenalty: 0,
|
||||
CurrHP: 0,
|
||||
CurrEnergy: 0,
|
||||
FetterList: nil,
|
||||
FetterList: make([]uint32, 0),
|
||||
SkillLevelMap: make(map[uint32]uint32),
|
||||
SkillExtraChargeMap: make(map[uint32]uint32),
|
||||
ProudSkillBonusMap: nil,
|
||||
SkillDepotId: uint32(avatarSkillDepotDataConfig.Id),
|
||||
CoreProudSkillLevel: 0,
|
||||
TalentIdList: make([]uint32, 0),
|
||||
ProudSkillList: make([]uint32, 0),
|
||||
SkillDepotId: uint32(skillDepotId),
|
||||
FlyCloak: 140001,
|
||||
Costume: 0,
|
||||
BornTime: time.Now().Unix(),
|
||||
FetterLevel: 1,
|
||||
FetterExp: 0,
|
||||
NameCardRewardId: 0,
|
||||
NameCardId: 0,
|
||||
Guid: 0,
|
||||
EquipGuidList: nil,
|
||||
EquipWeapon: nil,
|
||||
EquipReliquaryList: nil,
|
||||
FightPropMap: nil,
|
||||
ExtraAbilityEmbryos: nil,
|
||||
ExtraAbilityEmbryos: make(map[string]bool),
|
||||
}
|
||||
|
||||
if avatarSkillDepotDataConfig.EnergySkill > 0 {
|
||||
avatar.SkillLevelMap[uint32(avatarSkillDepotDataConfig.EnergySkill)] = 1
|
||||
}
|
||||
// 元素爆发1级
|
||||
avatar.SkillLevelMap[uint32(avatarSkillDepotDataConfig.EnergySkill)] = 1
|
||||
for _, skillId := range avatarSkillDepotDataConfig.Skills {
|
||||
if skillId > 0 {
|
||||
avatar.SkillLevelMap[uint32(skillId)] = 1
|
||||
}
|
||||
}
|
||||
for _, openData := range avatarSkillDepotDataConfig.InherentProudSkillOpens {
|
||||
if openData.ProudSkillGroupId == 0 {
|
||||
continue
|
||||
}
|
||||
if openData.NeedAvatarPromoteLevel <= int32(avatar.Promote) {
|
||||
proudSkillId := (openData.ProudSkillGroupId * 100) + 1
|
||||
// TODO if GameData.getProudSkillDataMap().containsKey(proudSkillId) java
|
||||
avatar.ProudSkillList = append(avatar.ProudSkillList, uint32(proudSkillId))
|
||||
}
|
||||
// 小技能1级
|
||||
avatar.SkillLevelMap[uint32(skillId)] = 1
|
||||
}
|
||||
avatar.CurrHP = avatarDataConfig.GetBaseHpByLevel(avatar.Level)
|
||||
|
||||
@@ -167,17 +141,33 @@ func (p *Player) AddAvatar(avatarId uint32) {
|
||||
}
|
||||
|
||||
func (p *Player) SetCurrEnergy(avatar *Avatar, value float64, max bool) {
|
||||
avatarDataConfig := gdc.CONF.AvatarDataMap[int32(avatar.AvatarId)]
|
||||
avatarSkillDepotDataConfig := gdc.CONF.AvatarSkillDepotDataMap[avatarDataConfig.SkillDepotId]
|
||||
if avatarSkillDepotDataConfig == nil || avatarSkillDepotDataConfig.EnergySkillData == nil {
|
||||
var avatarSkillDataConfig *gdconf.AvatarSkillData = nil
|
||||
if avatar.AvatarId == 10000005 || avatar.AvatarId == 10000007 {
|
||||
avatarSkillDepotDataConfig, exist := gdconf.CONF.AvatarSkillDepotDataMap[int32(avatar.SkillDepotId)]
|
||||
if !exist {
|
||||
return
|
||||
}
|
||||
avatarSkillDataConfig, exist = gdconf.CONF.AvatarSkillDataMap[avatarSkillDepotDataConfig.EnergySkill]
|
||||
if !exist {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
avatarSkillDataConfig = gdconf.CONF.GetAvatarEnergySkillConfig(avatar.AvatarId)
|
||||
}
|
||||
if avatarSkillDataConfig == nil {
|
||||
logger.Error("get avatar energy skill is nil, avatarId: %v", avatar.AvatarId)
|
||||
return
|
||||
}
|
||||
element := avatarSkillDepotDataConfig.ElementType
|
||||
avatar.FightPropMap[uint32(element.MaxEnergyProp)] = float32(avatarSkillDepotDataConfig.EnergySkillData.CostElemVal)
|
||||
elementType := constant.ElementTypeConst.VALUE_MAP[uint16(avatarSkillDataConfig.CostElemType)]
|
||||
if elementType == nil {
|
||||
logger.Error("get element type const is nil, value: %v", avatarSkillDataConfig.CostElemType)
|
||||
return
|
||||
}
|
||||
avatar.FightPropMap[uint32(elementType.MaxEnergyProp)] = float32(avatarSkillDataConfig.CostElemVal)
|
||||
if max {
|
||||
avatar.FightPropMap[uint32(element.CurrEnergyProp)] = float32(avatarSkillDepotDataConfig.EnergySkillData.CostElemVal)
|
||||
avatar.FightPropMap[uint32(elementType.CurrEnergyProp)] = float32(avatarSkillDataConfig.CostElemVal)
|
||||
} else {
|
||||
avatar.FightPropMap[uint32(element.CurrEnergyProp)] = float32(value)
|
||||
avatar.FightPropMap[uint32(elementType.CurrEnergyProp)] = float32(value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"hk4e/pkg/logger"
|
||||
"hk4e/protocol/proto"
|
||||
)
|
||||
|
||||
// 泛型通用转发器
|
||||
|
||||
type InvokeEntryType interface {
|
||||
proto.CombatInvokeEntry | proto.AbilityInvokeEntry
|
||||
}
|
||||
|
||||
type InvokeHandler[T InvokeEntryType] struct {
|
||||
EntryListForwardAll []*T
|
||||
EntryListForwardAllExceptCur []*T
|
||||
EntryListForwardHost []*T
|
||||
EntryListForwardServer []*T
|
||||
}
|
||||
|
||||
func NewInvokeHandler[T InvokeEntryType]() (r *InvokeHandler[T]) {
|
||||
r = new(InvokeHandler[T])
|
||||
r.InitInvokeHandler()
|
||||
return r
|
||||
}
|
||||
|
||||
func (i *InvokeHandler[T]) InitInvokeHandler() {
|
||||
i.EntryListForwardAll = make([]*T, 0)
|
||||
i.EntryListForwardAllExceptCur = make([]*T, 0)
|
||||
i.EntryListForwardHost = make([]*T, 0)
|
||||
i.EntryListForwardServer = make([]*T, 0)
|
||||
}
|
||||
|
||||
func (i *InvokeHandler[T]) AddEntry(forward proto.ForwardType, entry *T) {
|
||||
switch forward {
|
||||
case proto.ForwardType_FORWARD_TYPE_TO_ALL:
|
||||
i.EntryListForwardAll = append(i.EntryListForwardAll, entry)
|
||||
case proto.ForwardType_FORWARD_TYPE_TO_ALL_EXCEPT_CUR:
|
||||
fallthrough
|
||||
case proto.ForwardType_FORWARD_TYPE_TO_ALL_EXIST_EXCEPT_CUR:
|
||||
i.EntryListForwardAllExceptCur = append(i.EntryListForwardAllExceptCur, entry)
|
||||
case proto.ForwardType_FORWARD_TYPE_TO_HOST:
|
||||
i.EntryListForwardHost = append(i.EntryListForwardHost, entry)
|
||||
case proto.ForwardType_FORWARD_TYPE_ONLY_SERVER:
|
||||
i.EntryListForwardServer = append(i.EntryListForwardServer, entry)
|
||||
// logger.Error("forward server entry: %v", entry)
|
||||
default:
|
||||
logger.Error("forward type: %v, entry: %v", forward, entry)
|
||||
}
|
||||
}
|
||||
|
||||
func (i *InvokeHandler[T]) AllLen() int {
|
||||
return len(i.EntryListForwardAll)
|
||||
}
|
||||
|
||||
func (i *InvokeHandler[T]) AllExceptCurLen() int {
|
||||
return len(i.EntryListForwardAllExceptCur)
|
||||
}
|
||||
|
||||
func (i *InvokeHandler[T]) HostLen() int {
|
||||
return len(i.EntryListForwardHost)
|
||||
}
|
||||
|
||||
func (i *InvokeHandler[T]) ServerLen() int {
|
||||
return len(i.EntryListForwardServer)
|
||||
}
|
||||
|
||||
func (i *InvokeHandler[T]) Clear() {
|
||||
i.EntryListForwardAll = make([]*T, 0)
|
||||
i.EntryListForwardAllExceptCur = make([]*T, 0)
|
||||
i.EntryListForwardHost = make([]*T, 0)
|
||||
i.EntryListForwardServer = make([]*T, 0)
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"hk4e/pkg/logger"
|
||||
"hk4e/protocol/proto"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
@@ -96,14 +97,69 @@ func (p *Player) InitAll() {
|
||||
p.InitAllReliquary()
|
||||
}
|
||||
|
||||
func (p *Player) InitAllReliquary() {
|
||||
for reliquaryId, reliquary := range p.ReliquaryMap {
|
||||
reliquary.Guid = p.GetNextGameObjectGuid()
|
||||
p.ReliquaryMap[reliquaryId] = reliquary
|
||||
if reliquary.AvatarId != 0 {
|
||||
avatar := p.AvatarMap[reliquary.AvatarId]
|
||||
avatar.EquipGuidList[reliquary.Guid] = reliquary.Guid
|
||||
avatar.EquipReliquaryList = append(avatar.EquipReliquaryList, reliquary)
|
||||
}
|
||||
// 多人世界网络同步包转发器
|
||||
|
||||
type InvokeEntryType interface {
|
||||
proto.CombatInvokeEntry | proto.AbilityInvokeEntry
|
||||
}
|
||||
|
||||
type InvokeHandler[T InvokeEntryType] struct {
|
||||
EntryListForwardAll []*T
|
||||
EntryListForwardAllExceptCur []*T
|
||||
EntryListForwardHost []*T
|
||||
EntryListForwardServer []*T
|
||||
}
|
||||
|
||||
func NewInvokeHandler[T InvokeEntryType]() (r *InvokeHandler[T]) {
|
||||
r = new(InvokeHandler[T])
|
||||
r.InitInvokeHandler()
|
||||
return r
|
||||
}
|
||||
|
||||
func (i *InvokeHandler[T]) InitInvokeHandler() {
|
||||
i.EntryListForwardAll = make([]*T, 0)
|
||||
i.EntryListForwardAllExceptCur = make([]*T, 0)
|
||||
i.EntryListForwardHost = make([]*T, 0)
|
||||
i.EntryListForwardServer = make([]*T, 0)
|
||||
}
|
||||
|
||||
func (i *InvokeHandler[T]) AddEntry(forward proto.ForwardType, entry *T) {
|
||||
switch forward {
|
||||
case proto.ForwardType_FORWARD_TYPE_TO_ALL:
|
||||
i.EntryListForwardAll = append(i.EntryListForwardAll, entry)
|
||||
case proto.ForwardType_FORWARD_TYPE_TO_ALL_EXCEPT_CUR:
|
||||
fallthrough
|
||||
case proto.ForwardType_FORWARD_TYPE_TO_ALL_EXIST_EXCEPT_CUR:
|
||||
i.EntryListForwardAllExceptCur = append(i.EntryListForwardAllExceptCur, entry)
|
||||
case proto.ForwardType_FORWARD_TYPE_TO_HOST:
|
||||
i.EntryListForwardHost = append(i.EntryListForwardHost, entry)
|
||||
case proto.ForwardType_FORWARD_TYPE_ONLY_SERVER:
|
||||
i.EntryListForwardServer = append(i.EntryListForwardServer, entry)
|
||||
// logger.Error("forward server entry: %v", entry)
|
||||
default:
|
||||
logger.Error("forward type: %v, entry: %v", forward, entry)
|
||||
}
|
||||
}
|
||||
|
||||
func (i *InvokeHandler[T]) AllLen() int {
|
||||
return len(i.EntryListForwardAll)
|
||||
}
|
||||
|
||||
func (i *InvokeHandler[T]) AllExceptCurLen() int {
|
||||
return len(i.EntryListForwardAllExceptCur)
|
||||
}
|
||||
|
||||
func (i *InvokeHandler[T]) HostLen() int {
|
||||
return len(i.EntryListForwardHost)
|
||||
}
|
||||
|
||||
func (i *InvokeHandler[T]) ServerLen() int {
|
||||
return len(i.EntryListForwardServer)
|
||||
}
|
||||
|
||||
func (i *InvokeHandler[T]) Clear() {
|
||||
i.EntryListForwardAll = make([]*T, 0)
|
||||
i.EntryListForwardAllExceptCur = make([]*T, 0)
|
||||
i.EntryListForwardHost = make([]*T, 0)
|
||||
i.EntryListForwardServer = make([]*T, 0)
|
||||
}
|
||||
|
||||
@@ -1,16 +1,58 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"hk4e/gdconf"
|
||||
"hk4e/pkg/logger"
|
||||
)
|
||||
|
||||
type Reliquary struct {
|
||||
ReliquaryId uint64 `bson:"reliquaryId"` // 圣遗物的唯一id
|
||||
ItemId uint32 `bson:"itemId"` // 圣遗物的道具id
|
||||
Level uint8 `bson:"level"` // 等级
|
||||
Exp uint32 `bson:"exp"` // 当前经验值
|
||||
TotalExp uint32 `bson:"totalExp"` // 升级所需总经验值
|
||||
Promote uint8 `bson:"promote"` // 突破等阶
|
||||
Lock bool `bson:"lock"` // 锁定状态
|
||||
AffixIdList []uint32 `bson:"affixIdList"` // 词缀
|
||||
Refinement uint8 `bson:"refinement"` // 精炼等阶
|
||||
MainPropId uint32 `bson:"mainPropId"` // 主词条id
|
||||
AvatarId uint32 `bson:"avatarId"` // 装备角色id
|
||||
Guid uint64 `bson:"-"`
|
||||
}
|
||||
|
||||
func (p *Player) InitReliquary(reliquary *Reliquary) {
|
||||
reliquary.Guid = p.GetNextGameObjectGuid()
|
||||
p.ReliquaryMap[reliquary.ReliquaryId] = reliquary
|
||||
if reliquary.AvatarId != 0 {
|
||||
avatar := p.AvatarMap[reliquary.AvatarId]
|
||||
avatar.EquipGuidList[reliquary.Guid] = reliquary.Guid
|
||||
avatar.EquipReliquaryList = append(avatar.EquipReliquaryList, reliquary)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Player) InitAllReliquary() {
|
||||
for _, reliquary := range p.ReliquaryMap {
|
||||
p.InitReliquary(reliquary)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Player) AddReliquary(itemId uint32, reliquaryId uint64, mainPropId uint32) {
|
||||
reliquary := &Reliquary{
|
||||
ReliquaryId: reliquaryId,
|
||||
ItemId: itemId,
|
||||
Level: 1,
|
||||
Exp: 0,
|
||||
Promote: 0,
|
||||
Lock: false,
|
||||
AffixIdList: make([]uint32, 0),
|
||||
MainPropId: mainPropId,
|
||||
AvatarId: 0,
|
||||
Guid: 0,
|
||||
}
|
||||
itemDataConfig, exist := gdconf.CONF.ItemDataMap[int32(itemId)]
|
||||
if !exist {
|
||||
logger.Error("reliquary config is nil, itemId: %v", itemId)
|
||||
return
|
||||
}
|
||||
_ = itemDataConfig
|
||||
p.InitReliquary(reliquary)
|
||||
p.ReliquaryMap[reliquaryId] = reliquary
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ package model
|
||||
|
||||
import (
|
||||
"hk4e/common/constant"
|
||||
gdc "hk4e/gs/config"
|
||||
"hk4e/gdconf"
|
||||
"hk4e/pkg/logger"
|
||||
)
|
||||
|
||||
type Team struct {
|
||||
@@ -55,16 +56,22 @@ func NewTeamInfo() (r *TeamInfo) {
|
||||
|
||||
func (t *TeamInfo) UpdateTeam() {
|
||||
activeTeam := t.GetActiveTeam()
|
||||
// 队伍元素共鸣
|
||||
// TODO 队伍元素共鸣
|
||||
t.TeamResonances = make(map[uint16]bool)
|
||||
t.TeamResonancesConfig = make(map[int32]bool)
|
||||
teamElementTypeCountMap := make(map[uint16]uint8)
|
||||
avatarSkillDepotDataMapConfig := gdc.CONF.AvatarSkillDepotDataMap
|
||||
for _, avatarId := range activeTeam.GetAvatarIdList() {
|
||||
skillData := avatarSkillDepotDataMapConfig[int32(avatarId)]
|
||||
if skillData != nil {
|
||||
teamElementTypeCountMap[skillData.ElementType.Value] += 1
|
||||
avatarSkillDataConfig := gdconf.CONF.GetAvatarEnergySkillConfig(avatarId)
|
||||
if avatarSkillDataConfig == nil {
|
||||
logger.Error("get avatar energy skill is nil, avatarId: %v", avatarId)
|
||||
continue
|
||||
}
|
||||
elementType := constant.ElementTypeConst.VALUE_MAP[uint16(avatarSkillDataConfig.CostElemType)]
|
||||
if elementType == nil {
|
||||
logger.Error("get element type const is nil, value: %v", avatarSkillDataConfig.CostElemType)
|
||||
continue
|
||||
}
|
||||
teamElementTypeCountMap[elementType.Value] += 1
|
||||
}
|
||||
for k, v := range teamElementTypeCountMap {
|
||||
if v >= 2 {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
gdc "hk4e/gs/config"
|
||||
"hk4e/gdconf"
|
||||
"hk4e/pkg/logger"
|
||||
)
|
||||
|
||||
@@ -10,12 +10,10 @@ type Weapon struct {
|
||||
ItemId uint32 `bson:"itemId"` // 武器的道具id
|
||||
Level uint8 `bson:"level"` // 等级
|
||||
Exp uint32 `bson:"exp"` // 当前经验值
|
||||
TotalExp uint32 `bson:"totalExp"` // 升级所需总经验值
|
||||
Promote uint8 `bson:"promote"` // 突破等阶
|
||||
Lock bool `bson:"lock"` // 锁定状态
|
||||
AffixIdList []uint32 `bson:"affixIdList"` // 词缀
|
||||
Refinement uint8 `bson:"refinement"` // 精炼等阶
|
||||
MainPropId uint32 `bson:"mainPropId"` // 主词条id
|
||||
AvatarId uint32 `bson:"avatarId"` // 装备角色id
|
||||
Guid uint64 `bson:"-"`
|
||||
}
|
||||
@@ -29,7 +27,6 @@ func (p *Player) InitWeapon(weapon *Weapon) {
|
||||
avatar.EquipGuidList[weapon.Guid] = weapon.Guid
|
||||
avatar.EquipWeapon = weapon
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (p *Player) InitAllWeapon() {
|
||||
@@ -56,25 +53,19 @@ func (p *Player) AddWeapon(itemId uint32, weaponId uint64) {
|
||||
ItemId: itemId,
|
||||
Level: 1,
|
||||
Exp: 0,
|
||||
TotalExp: 0,
|
||||
Promote: 0,
|
||||
Lock: false,
|
||||
AffixIdList: make([]uint32, 0),
|
||||
Refinement: 0,
|
||||
MainPropId: 0,
|
||||
Guid: 0,
|
||||
}
|
||||
itemDataConfig, ok := gdc.CONF.ItemDataMap[int32(itemId)]
|
||||
if !ok {
|
||||
logger.Error("config is nil, itemId: %v", itemId)
|
||||
itemDataConfig, exist := gdconf.CONF.ItemDataMap[int32(itemId)]
|
||||
if !exist {
|
||||
logger.Error("weapon config is nil, itemId: %v", itemId)
|
||||
return
|
||||
}
|
||||
if itemDataConfig.SkillAffix != nil {
|
||||
for _, skillAffix := range itemDataConfig.SkillAffix {
|
||||
if skillAffix > 0 {
|
||||
weapon.AffixIdList = append(weapon.AffixIdList, uint32(skillAffix))
|
||||
}
|
||||
}
|
||||
for _, skillAffix := range itemDataConfig.SkillAffix {
|
||||
weapon.AffixIdList = append(weapon.AffixIdList, uint32(skillAffix))
|
||||
}
|
||||
p.InitWeapon(weapon)
|
||||
p.WeaponMap[weaponId] = weapon
|
||||
|
||||
Reference in New Issue
Block a user