mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-04 17:02:26 +08:00
修复场景小组配置id读取顺序问题
This commit is contained in:
@@ -59,6 +59,7 @@ type GameDataConfig struct {
|
||||
ReliquaryMainDataMap map[int32]map[int32]*ReliquaryMainData // 圣遗物主属性
|
||||
ReliquaryAffixDataMap map[int32]map[int32]*ReliquaryAffixData // 圣遗物追加属性
|
||||
QuestDataMap map[int32]*QuestData // 任务
|
||||
ParentQuestMap map[int32]map[int32]*QuestData // 父任务索引
|
||||
DropDataMap map[int32]*DropData // 掉落
|
||||
MonsterDropDataMap map[string]map[int32]*MonsterDropData // 怪物掉落
|
||||
ChestDropDataMap map[string]map[int32]*ChestDropData // 宝箱掉落
|
||||
|
||||
@@ -373,6 +373,15 @@ func (g *GameDataConfig) loadQuestData() {
|
||||
g.QuestDataMap[questData.QuestId] = questData
|
||||
}
|
||||
}
|
||||
g.ParentQuestMap = make(map[int32]map[int32]*QuestData)
|
||||
for _, questData := range g.QuestDataMap {
|
||||
questMap, exist := g.ParentQuestMap[questData.ParentQuestId]
|
||||
if !exist {
|
||||
questMap = make(map[int32]*QuestData)
|
||||
g.ParentQuestMap[questData.ParentQuestId] = questMap
|
||||
}
|
||||
questMap[questData.QuestId] = questData
|
||||
}
|
||||
logger.Info("QuestData count: %v", len(g.QuestDataMap))
|
||||
}
|
||||
|
||||
@@ -383,3 +392,7 @@ func GetQuestDataById(questId int32) *QuestData {
|
||||
func GetQuestDataMap() map[int32]*QuestData {
|
||||
return CONF.QuestDataMap
|
||||
}
|
||||
|
||||
func GetQuestDataMapByParentQuestId(parentQuestId int32) map[int32]*QuestData {
|
||||
return CONF.ParentQuestMap[parentQuestId]
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ type Group struct {
|
||||
RegionMap map[int32]*Region `json:"-"` // 区域
|
||||
TriggerMap map[string]*Trigger `json:"-"` // 触发器
|
||||
GroupInitConfig *GroupInitConfig `json:"-"` // 初始化配置
|
||||
SuiteList []*Suite `json:"-"` // 小组配置
|
||||
SuiteMap map[int32]*Suite `json:"-"` // 小组配置
|
||||
LuaStr string `json:"-"` // LUA原始字符串缓存
|
||||
LuaState *lua.LState `json:"-"` // LUA虚拟机实例
|
||||
}
|
||||
@@ -241,8 +241,8 @@ func (g *GameDataConfig) loadGroup(group *Group, block *Block, sceneId int32, bl
|
||||
if len(suiteLuaTableList) == 0 {
|
||||
// logger.Debug("get suites object is nil, sceneId: %v, blockId: %v, groupId: %v", sceneId, blockId, groupId)
|
||||
}
|
||||
group.SuiteList = make([]*Suite, 0)
|
||||
for _, suiteLuaTable := range suiteLuaTableList {
|
||||
group.SuiteMap = make(map[int32]*Suite)
|
||||
for index, suiteLuaTable := range suiteLuaTableList {
|
||||
suite := &Suite{
|
||||
MonsterConfigIdList: make([]int32, 0),
|
||||
GadgetConfigIdList: make([]int32, 0),
|
||||
@@ -274,7 +274,7 @@ func (g *GameDataConfig) loadGroup(group *Group, block *Block, sceneId int32, bl
|
||||
suite.TriggerNameList = append(suite.TriggerNameList, nameAny.(string))
|
||||
}
|
||||
}
|
||||
group.SuiteList = append(group.SuiteList, suite)
|
||||
group.SuiteMap[int32(len(suiteLuaTableList)-index)] = suite
|
||||
}
|
||||
luaState.Close()
|
||||
block.groupMapLoadLock.Lock()
|
||||
|
||||
@@ -337,12 +337,11 @@ func (s *Scene) AddGroupSuite(groupId uint32, suiteId uint8) {
|
||||
logger.Error("get scene group config is nil, groupId: %v", groupId)
|
||||
return
|
||||
}
|
||||
suiteIndex := suiteId - 1
|
||||
if int(suiteIndex) >= len(groupConfig.SuiteList) {
|
||||
suiteConfig, exist := groupConfig.SuiteMap[int32(suiteId)]
|
||||
if !exist {
|
||||
logger.Error("invalid suiteId: %v", suiteId)
|
||||
return
|
||||
}
|
||||
suiteConfig := groupConfig.SuiteList[suiteIndex]
|
||||
suite := &Suite{
|
||||
entityMap: make(map[uint32]*Entity),
|
||||
}
|
||||
@@ -459,9 +458,9 @@ func getTempFightPropMap() map[uint32]float32 {
|
||||
constant.FIGHT_PROP_CUR_ATTACK: float32(50.0),
|
||||
constant.FIGHT_PROP_BASE_DEFENSE: float32(500.0),
|
||||
constant.FIGHT_PROP_CUR_DEFENSE: float32(500.0),
|
||||
constant.FIGHT_PROP_BASE_HP: float32(10000.0),
|
||||
constant.FIGHT_PROP_CUR_HP: float32(10000.0),
|
||||
constant.FIGHT_PROP_MAX_HP: float32(10000.0),
|
||||
constant.FIGHT_PROP_BASE_HP: float32(5000.0),
|
||||
constant.FIGHT_PROP_CUR_HP: float32(5000.0),
|
||||
constant.FIGHT_PROP_MAX_HP: float32(5000.0),
|
||||
constant.FIGHT_PROP_PHYSICAL_SUB_HURT: float32(0.1),
|
||||
constant.FIGHT_PROP_ICE_SUB_HURT: float32(0.1),
|
||||
constant.FIGHT_PROP_FIRE_SUB_HURT: float32(0.1),
|
||||
|
||||
@@ -17,7 +17,7 @@ func (g *Game) SceneRegionTriggerCheck(player *model.Player, scene *Scene, oldPo
|
||||
continue
|
||||
}
|
||||
for suiteId := range group.GetAllSuite() {
|
||||
suiteConfig := groupConfig.SuiteList[suiteId-1]
|
||||
suiteConfig := groupConfig.SuiteMap[int32(suiteId)]
|
||||
for _, regionConfigId := range suiteConfig.RegionConfigIdList {
|
||||
regionConfig := groupConfig.RegionMap[regionConfigId]
|
||||
if regionConfig == nil {
|
||||
@@ -115,7 +115,7 @@ func (g *Game) MonsterDieTriggerCheck(player *model.Player, groupId uint32, grou
|
||||
return
|
||||
}
|
||||
for suiteId := range group.GetAllSuite() {
|
||||
suiteConfig := groupConfig.SuiteList[suiteId-1]
|
||||
suiteConfig := groupConfig.SuiteMap[int32(suiteId)]
|
||||
for _, triggerName := range suiteConfig.TriggerNameList {
|
||||
triggerConfig := groupConfig.TriggerMap[triggerName]
|
||||
if triggerConfig.Event != constant.LUA_EVENT_ANY_MONSTER_DIE {
|
||||
@@ -157,7 +157,7 @@ func (g *Game) QuestStartTriggerCheck(player *model.Player, questId uint32) {
|
||||
continue
|
||||
}
|
||||
for suiteId := range group.GetAllSuite() {
|
||||
suiteConfig := groupConfig.SuiteList[suiteId-1]
|
||||
suiteConfig := groupConfig.SuiteMap[int32(suiteId)]
|
||||
for _, triggerName := range suiteConfig.TriggerNameList {
|
||||
triggerConfig := groupConfig.TriggerMap[triggerName]
|
||||
if triggerConfig.Event != constant.LUA_EVENT_QUEST_START {
|
||||
|
||||
@@ -316,6 +316,13 @@ func (g *Game) AbilityInvocationsNotify(player *model.Player, payloadMsg pb.Mess
|
||||
// logger.Debug("AbilityInvocationsNotify: %v", entry, player.PlayerID)
|
||||
switch entry.ArgumentType {
|
||||
case proto.AbilityInvokeArgument_ABILITY_META_MODIFIER_CHANGE:
|
||||
modifierChange := new(proto.AbilityMetaModifierChange)
|
||||
err := pb.Unmarshal(entry.AbilityData, modifierChange)
|
||||
if err != nil {
|
||||
logger.Error("parse AbilityMetaModifierChange error: %v", err)
|
||||
continue
|
||||
}
|
||||
// logger.Error("MC: %v", modifierChange)
|
||||
worldAvatar := world.GetWorldAvatarByEntityId(entry.EntityId)
|
||||
if worldAvatar != nil {
|
||||
for _, ability := range worldAvatar.abilityList {
|
||||
|
||||
@@ -116,8 +116,6 @@ func (g *Game) OnLoginOk(userId uint32, clientSeq uint32, gateAppId string, isRe
|
||||
TICK_MANAGER.CreateUserGlobalTick(userId)
|
||||
TICK_MANAGER.CreateUserTimer(userId, UserTimerActionTest, 100, player.NickName)
|
||||
|
||||
g.AcceptQuest(player, true)
|
||||
|
||||
atomic.AddInt32(&ONLINE_PLAYER_NUM, 1)
|
||||
|
||||
SELF = nil
|
||||
@@ -240,6 +238,7 @@ func (g *Game) LoginNotify(userId uint32, player *model.Player, clientSeq uint32
|
||||
g.SendMsg(cmd.AvatarDataNotify, userId, clientSeq, g.PacketAvatarDataNotify(player))
|
||||
g.SendMsg(cmd.OpenStateUpdateNotify, userId, clientSeq, g.PacketOpenStateUpdateNotify())
|
||||
g.SendMsg(cmd.QuestListNotify, userId, clientSeq, g.PacketQuestListNotify(player))
|
||||
g.SendMsg(cmd.FinishedParentQuestNotify, userId, clientSeq, g.PacketFinishedParentQuestNotify(player))
|
||||
// g.GCGLogin(player) // 发送GCG登录相关的通知包
|
||||
playerLoginRsp := &proto.PlayerLoginRsp{
|
||||
IsUseAbilityHash: true,
|
||||
|
||||
@@ -19,7 +19,9 @@ func (g *Game) AddQuestContentProgressReq(player *model.Player, payloadMsg pb.Me
|
||||
req := payloadMsg.(*proto.AddQuestContentProgressReq)
|
||||
logger.Debug("AddQuestContentProgressReq: %v", req)
|
||||
|
||||
g.AddQuestProgress(player, req)
|
||||
g.TriggerQuest(player, int32(req.ContentType), "", int32(req.Param))
|
||||
|
||||
// g.AddQuestProgress(player, req)
|
||||
|
||||
rsp := &proto.AddQuestContentProgressRsp{
|
||||
ContentType: req.ContentType,
|
||||
@@ -225,11 +227,23 @@ func (g *Game) TriggerQuest(player *model.Player, cond int32, complexParam strin
|
||||
if questDataConfig == nil {
|
||||
continue
|
||||
}
|
||||
// TODO 实在不知道客户端要在怎样的情况下 才会发长按10006这个技能 这里先临时改表解决了
|
||||
// 是走ability体系计算出来的 操了
|
||||
if questDataConfig.QuestId == 35303 {
|
||||
questDataConfig.FinishCondList[0].Param[0] = 10067
|
||||
}
|
||||
for _, questCond := range questDataConfig.FinishCondList {
|
||||
if questCond.Type != cond {
|
||||
continue
|
||||
}
|
||||
switch cond {
|
||||
case constant.QUEST_FINISH_COND_TYPE_FINISH_PLOT:
|
||||
ok := matchParamEqual(questCond.Param, param, 1)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
dbQuest.ForceFinishQuest(quest.QuestId)
|
||||
updateQuestIdList = append(updateQuestIdList, quest.QuestId)
|
||||
case constant.QUEST_FINISH_COND_TYPE_TRIGGER_FIRE:
|
||||
// 场景触发器跳了 参数1:触发器id
|
||||
ok := matchParamEqual(questCond.Param, param, 1)
|
||||
@@ -273,17 +287,63 @@ func (g *Game) TriggerQuest(player *model.Player, cond int32, complexParam strin
|
||||
}
|
||||
}
|
||||
if len(updateQuestIdList) > 0 {
|
||||
ntf := &proto.QuestListUpdateNotify{
|
||||
QuestList: make([]*proto.Quest, 0),
|
||||
}
|
||||
questList := make([]*proto.Quest, 0)
|
||||
for _, questId := range updateQuestIdList {
|
||||
pbQuest := g.PacketQuest(player, questId)
|
||||
if pbQuest == nil {
|
||||
continue
|
||||
}
|
||||
ntf.QuestList = append(ntf.QuestList, pbQuest)
|
||||
questList = append(questList, pbQuest)
|
||||
}
|
||||
g.SendMsg(cmd.QuestListUpdateNotify, player.PlayerID, player.ClientSeq, &proto.QuestListUpdateNotify{
|
||||
QuestList: questList,
|
||||
})
|
||||
parentQuestList := make([]*proto.ParentQuest, 0)
|
||||
parentQuestMap := make(map[int32]bool)
|
||||
for _, questId := range updateQuestIdList {
|
||||
questDataConfig := gdconf.GetQuestDataById(int32(questId))
|
||||
if questDataConfig == nil {
|
||||
continue
|
||||
}
|
||||
_, exist := parentQuestMap[questDataConfig.ParentQuestId]
|
||||
if exist {
|
||||
continue
|
||||
}
|
||||
parentQuestMap[questDataConfig.ParentQuestId] = true
|
||||
finishedParentQuest := true
|
||||
subQuestDataMap := gdconf.GetQuestDataMapByParentQuestId(questDataConfig.ParentQuestId)
|
||||
for _, subQuestData := range subQuestDataMap {
|
||||
quest := dbQuest.GetQuestById(uint32(subQuestData.QuestId))
|
||||
if quest == nil {
|
||||
finishedParentQuest = false
|
||||
break
|
||||
}
|
||||
if quest.State != constant.QUEST_STATE_FINISHED {
|
||||
finishedParentQuest = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if finishedParentQuest {
|
||||
childQuestList := make([]*proto.ChildQuest, 0)
|
||||
for _, subQuestData := range subQuestDataMap {
|
||||
childQuestList = append(childQuestList, &proto.ChildQuest{
|
||||
State: constant.QUEST_STATE_FINISHED,
|
||||
QuestId: uint32(subQuestData.QuestId),
|
||||
})
|
||||
}
|
||||
parentQuestList = append(parentQuestList, &proto.ParentQuest{
|
||||
ParentQuestId: uint32(questDataConfig.ParentQuestId),
|
||||
ParentQuestState: 1,
|
||||
IsFinished: true,
|
||||
ChildQuestList: childQuestList,
|
||||
})
|
||||
}
|
||||
}
|
||||
if len(parentQuestList) > 0 {
|
||||
g.SendMsg(cmd.FinishedParentQuestUpdateNotify, player.PlayerID, player.ClientSeq, &proto.FinishedParentQuestUpdateNotify{
|
||||
ParentQuestList: parentQuestList,
|
||||
})
|
||||
}
|
||||
g.SendMsg(cmd.QuestListUpdateNotify, player.PlayerID, player.ClientSeq, ntf)
|
||||
g.AcceptQuest(player, true)
|
||||
}
|
||||
}
|
||||
@@ -315,7 +375,7 @@ func (g *Game) PacketQuest(player *model.Player, questId uint32) *proto.Quest {
|
||||
|
||||
// PacketQuestListNotify 打包任务列表通知
|
||||
func (g *Game) PacketQuestListNotify(player *model.Player) *proto.QuestListNotify {
|
||||
questListNotify := &proto.QuestListNotify{
|
||||
ntf := &proto.QuestListNotify{
|
||||
QuestList: make([]*proto.Quest, 0),
|
||||
}
|
||||
dbQuest := player.GetDbQuest()
|
||||
@@ -324,7 +384,56 @@ func (g *Game) PacketQuestListNotify(player *model.Player) *proto.QuestListNotif
|
||||
if pbQuest == nil {
|
||||
continue
|
||||
}
|
||||
questListNotify.QuestList = append(questListNotify.QuestList, pbQuest)
|
||||
ntf.QuestList = append(ntf.QuestList, pbQuest)
|
||||
}
|
||||
return questListNotify
|
||||
return ntf
|
||||
}
|
||||
|
||||
// PacketFinishedParentQuestNotify 打包已完成父任务列表通知
|
||||
func (g *Game) PacketFinishedParentQuestNotify(player *model.Player) *proto.FinishedParentQuestNotify {
|
||||
ntf := &proto.FinishedParentQuestNotify{
|
||||
ParentQuestList: make([]*proto.ParentQuest, 0),
|
||||
}
|
||||
dbQuest := player.GetDbQuest()
|
||||
parentQuestMap := make(map[int32]bool)
|
||||
for questId := range dbQuest.GetQuestMap() {
|
||||
questDataConfig := gdconf.GetQuestDataById(int32(questId))
|
||||
if questDataConfig == nil {
|
||||
continue
|
||||
}
|
||||
_, exist := parentQuestMap[questDataConfig.ParentQuestId]
|
||||
if exist {
|
||||
continue
|
||||
}
|
||||
parentQuestMap[questDataConfig.ParentQuestId] = true
|
||||
finishedParentQuest := true
|
||||
subQuestDataMap := gdconf.GetQuestDataMapByParentQuestId(questDataConfig.ParentQuestId)
|
||||
for _, subQuestData := range subQuestDataMap {
|
||||
quest := dbQuest.GetQuestById(uint32(subQuestData.QuestId))
|
||||
if quest == nil {
|
||||
finishedParentQuest = false
|
||||
break
|
||||
}
|
||||
if quest.State != constant.QUEST_STATE_FINISHED {
|
||||
finishedParentQuest = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if finishedParentQuest {
|
||||
childQuestList := make([]*proto.ChildQuest, 0)
|
||||
for _, subQuestData := range subQuestDataMap {
|
||||
childQuestList = append(childQuestList, &proto.ChildQuest{
|
||||
State: constant.QUEST_STATE_FINISHED,
|
||||
QuestId: uint32(subQuestData.QuestId),
|
||||
})
|
||||
}
|
||||
ntf.ParentQuestList = append(ntf.ParentQuestList, &proto.ParentQuest{
|
||||
ParentQuestId: uint32(questDataConfig.ParentQuestId),
|
||||
ParentQuestState: 1,
|
||||
IsFinished: true,
|
||||
ChildQuestList: childQuestList,
|
||||
})
|
||||
}
|
||||
}
|
||||
return ntf
|
||||
}
|
||||
|
||||
@@ -651,8 +651,9 @@ func (g *Game) GetNeighborGroup(sceneId uint32, pos *model.Vector) map[uint32]*g
|
||||
|
||||
// AddSceneGroup 加载场景组
|
||||
func (g *Game) AddSceneGroup(player *model.Player, scene *Scene, groupConfig *gdconf.Group) {
|
||||
initSuiteId := int(groupConfig.GroupInitConfig.Suite)
|
||||
if initSuiteId < 1 || initSuiteId > len(groupConfig.SuiteList) {
|
||||
initSuiteId := groupConfig.GroupInitConfig.Suite
|
||||
_, exist := groupConfig.SuiteMap[initSuiteId]
|
||||
if !exist {
|
||||
logger.Error("invalid init suite id: %v, uid: %v", initSuiteId, player.PlayerID)
|
||||
return
|
||||
}
|
||||
@@ -689,7 +690,8 @@ func (g *Game) AddSceneGroupSuite(player *model.Player, groupId uint32, suiteId
|
||||
logger.Error("get group config is nil, groupId: %v, uid: %v", groupId, player.PlayerID)
|
||||
return
|
||||
}
|
||||
if suiteId < 1 || suiteId > uint8(len(groupConfig.SuiteList)) {
|
||||
_, exist := groupConfig.SuiteMap[int32(suiteId)]
|
||||
if !exist {
|
||||
logger.Error("invalid suite id: %v, uid: %v", suiteId, player.PlayerID)
|
||||
return
|
||||
}
|
||||
@@ -719,8 +721,9 @@ func (g *Game) AddSceneGroupMonster(player *model.Player, groupId uint32, monste
|
||||
logger.Error("get group config is nil, groupId: %v, uid: %v", groupId, player.PlayerID)
|
||||
return
|
||||
}
|
||||
initSuiteId := int(groupConfig.GroupInitConfig.Suite)
|
||||
if initSuiteId < 1 || initSuiteId > len(groupConfig.SuiteList) {
|
||||
initSuiteId := groupConfig.GroupInitConfig.Suite
|
||||
_, exist := groupConfig.SuiteMap[initSuiteId]
|
||||
if !exist {
|
||||
logger.Error("invalid init suite id: %v, uid: %v", initSuiteId, player.PlayerID)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ func (g *Game) HandleAbilityStamina(player *model.Player, entry *proto.AbilityIn
|
||||
hashCode := endec.Hk4eAbilityHashCode(avatarSkillData.AbilityName)
|
||||
if uint32(hashCode) == abilityNameHashCode {
|
||||
avatarAbility = avatarSkillData
|
||||
break
|
||||
}
|
||||
}
|
||||
if avatarAbility == nil {
|
||||
|
||||
Reference in New Issue
Block a user