mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-12 20:12:26 +08:00
修复开场任务
This commit is contained in:
@@ -30,8 +30,8 @@ type Avatar struct {
|
||||
Promote uint8 // 突破等阶
|
||||
Satiation uint32 // 饱食度
|
||||
SatiationPenalty uint32 // 饱食度溢出
|
||||
CurrHP float32 // 当前生命值
|
||||
CurrEnergy float32 // 当前元素能量值
|
||||
CurrHP float64 // 当前生命值
|
||||
CurrEnergy float64 // 当前元素能量值
|
||||
FetterList []uint32 // 资料解锁条目
|
||||
SkillLevelMap map[uint32]uint32 // 技能等级数据
|
||||
SkillDepotId uint32 // 技能库id
|
||||
@@ -85,7 +85,7 @@ func (a *DbAvatar) InitAvatarFightProp(avatar *Avatar) {
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_CUR_DEFENSE] = avatarDataConfig.GetBaseDefenseByLevel(avatar.Level)
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_MAX_HP] = avatarDataConfig.GetBaseHpByLevel(avatar.Level)
|
||||
// 当前血量
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_CUR_HP] = avatar.CurrHP
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_CUR_HP] = float32(avatar.CurrHP)
|
||||
// 双暴
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_CRITICAL] = avatarDataConfig.Critical
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_CRITICAL_HURT] = avatarDataConfig.CriticalHurt
|
||||
@@ -147,7 +147,7 @@ func (a *DbAvatar) AddAvatar(player *Player, avatarId uint32) {
|
||||
// 小技能1级
|
||||
avatar.SkillLevelMap[uint32(skillId)] = 1
|
||||
}
|
||||
avatar.CurrHP = avatarDataConfig.GetBaseHpByLevel(avatar.Level)
|
||||
avatar.CurrHP = float64(avatarDataConfig.GetBaseHpByLevel(avatar.Level))
|
||||
|
||||
// 角色突破奖励领取状态
|
||||
for promoteLevel := range avatarDataConfig.PromoteRewardMap {
|
||||
@@ -158,7 +158,7 @@ func (a *DbAvatar) AddAvatar(player *Player, avatarId uint32) {
|
||||
a.AvatarMap[avatarId] = avatar
|
||||
}
|
||||
|
||||
func (a *DbAvatar) SetCurrEnergy(avatar *Avatar, value float32, max bool) {
|
||||
func (a *DbAvatar) SetCurrEnergy(avatar *Avatar, value float64, max bool) {
|
||||
var avatarSkillDataConfig *gdconf.AvatarSkillData = nil
|
||||
if avatar.AvatarId == 10000005 || avatar.AvatarId == 10000007 {
|
||||
avatarSkillDepotDataConfig := gdconf.GetAvatarSkillDepotDataById(int32(avatar.SkillDepotId))
|
||||
@@ -185,7 +185,7 @@ func (a *DbAvatar) SetCurrEnergy(avatar *Avatar, value float32, max bool) {
|
||||
if max {
|
||||
avatar.FightPropMap[uint32(elementType.CurrEnergyProp)] = float32(avatarSkillDataConfig.CostElemVal)
|
||||
} else {
|
||||
avatar.FightPropMap[uint32(elementType.CurrEnergyProp)] = value
|
||||
avatar.FightPropMap[uint32(elementType.CurrEnergyProp)] = float32(value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package model
|
||||
|
||||
type DbGacha struct {
|
||||
GachaPoolInfo map[uint32]*GachaPoolInfo
|
||||
}
|
||||
|
||||
type GachaPoolInfo struct {
|
||||
GachaType uint32 // 卡池类型
|
||||
OrangeTimes uint32 // 5星保底计数
|
||||
@@ -8,10 +12,6 @@ type GachaPoolInfo struct {
|
||||
MustGetUpPurple bool // 是否4星大保底
|
||||
}
|
||||
|
||||
type DbGacha struct {
|
||||
GachaPoolInfo map[uint32]*GachaPoolInfo
|
||||
}
|
||||
|
||||
func (p *Player) GetDbGacha() *DbGacha {
|
||||
if p.DbGacha == nil {
|
||||
p.DbGacha = NewDbGacha()
|
||||
|
||||
72
gs/model/db_world.go
Normal file
72
gs/model/db_world.go
Normal file
@@ -0,0 +1,72 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"hk4e/gdconf"
|
||||
)
|
||||
|
||||
type DbScene struct {
|
||||
SceneId uint32
|
||||
UnlockPointMap map[uint32]bool
|
||||
}
|
||||
|
||||
type DbWorld struct {
|
||||
SceneMap map[uint32]*DbScene
|
||||
}
|
||||
|
||||
func (p *Player) GetDbWorld() *DbWorld {
|
||||
if p.DbWorld == nil {
|
||||
p.DbWorld = NewDbWorld()
|
||||
}
|
||||
return p.DbWorld
|
||||
}
|
||||
|
||||
func NewDbWorld() *DbWorld {
|
||||
r := &DbWorld{
|
||||
SceneMap: make(map[uint32]*DbScene),
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func NewScene(sceneId uint32) *DbScene {
|
||||
r := &DbScene{
|
||||
SceneId: sceneId,
|
||||
UnlockPointMap: make(map[uint32]bool),
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func (w *DbWorld) GetSceneById(sceneId uint32) *DbScene {
|
||||
scene, exist := w.SceneMap[sceneId]
|
||||
// 不存在自动创建场景
|
||||
if !exist {
|
||||
// 拒绝创建配置表中不存在的非法场景
|
||||
sceneDataConfig := gdconf.GetSceneDataById(int32(sceneId))
|
||||
if sceneDataConfig == nil {
|
||||
return nil
|
||||
}
|
||||
scene = NewScene(sceneId)
|
||||
w.SceneMap[sceneId] = scene
|
||||
}
|
||||
return scene
|
||||
}
|
||||
|
||||
func (s *DbScene) GetUnlockPointList() []uint32 {
|
||||
unlockPointList := make([]uint32, 0)
|
||||
for pointId := range s.UnlockPointMap {
|
||||
unlockPointList = append(unlockPointList, pointId)
|
||||
}
|
||||
return unlockPointList
|
||||
}
|
||||
|
||||
func (s *DbScene) UnlockPoint(pointId uint32) {
|
||||
pointDataConfig := gdconf.GetScenePointBySceneIdAndPointId(int32(s.SceneId), int32(pointId))
|
||||
if pointDataConfig == nil {
|
||||
return
|
||||
}
|
||||
s.UnlockPointMap[pointId] = true
|
||||
}
|
||||
|
||||
func (s *DbScene) CheckPointUnlock(pointId uint32) bool {
|
||||
_, exist := s.UnlockPointMap[pointId]
|
||||
return exist
|
||||
}
|
||||
@@ -53,6 +53,7 @@ type Player struct {
|
||||
DbAvatar *DbAvatar // 角色
|
||||
DbGacha *DbGacha // 卡池
|
||||
DbQuest *DbQuest // 任务
|
||||
DbWorld *DbWorld // 大世界
|
||||
// 在线数据 请随意 记得加忽略字段的tag
|
||||
LastSaveTime uint32 `bson:"-" msgpack:"-"` // 上一次保存时间
|
||||
EnterSceneToken uint32 `bson:"-" msgpack:"-"` // 世界进入令牌
|
||||
|
||||
Reference in New Issue
Block a user