yy преди 1 година
родител
ревизия
86ddd30e18

+ 49 - 33
RO_Server_Trunk-branch_0.1.39/roserver/game/model/role_battle.go

@@ -244,18 +244,18 @@ const (
 type RoleBattle struct {
 	SaveObject
 
-	incomeTime         uint64
-	maxIncomeTime      uint64
-	mapLevel           uint32
-	mapId              uint32
-	mapLevelHard       uint32 //困难模式
-	mapIdHard          uint32 //困难模式
-	mapRewardCount     uint32 //累计的挑战boss成功次数
-	mapRewardId        uint32
-	mapRewardLevel     uint32
-	mapRewardIdHard    uint32 //困难模式
-	mapRewardLevelHard uint32 //困难模式
-	mapLevelTime       uint64
+	incomeTime     uint64
+	maxIncomeTime  uint64
+	mapLevel       uint32
+	mapId          uint32
+	mapLevelHard   uint32 //困难模式
+	mapIdHard      uint32 //困难模式
+	mapRewardCount uint32 //累计的挑战boss成功次数
+	mapRewardId    uint32
+	mapRewardLevel uint32
+	//mapRewardIdHard    uint32 //困难模式
+	//mapRewardLevelHard uint32 //困难模式
+	mapLevelTime uint64
 
 	selfRank                 uint32
 	totalRanks               uint32
@@ -328,8 +328,8 @@ func (this *RoleBattle) Load(msg interface{}) bool {
 		this.mapRewardCount = proRole.RoleBattle.RewardMapCount
 		this.mapRewardId = proRole.RoleBattle.RewardMapId
 		this.mapRewardLevel = proRole.RoleBattle.RewardMapLevel
-		this.mapRewardIdHard = proRole.RoleBattle.RewardMapIdHard
-		this.mapRewardLevelHard = proRole.RoleBattle.RewardMapLevelHard
+		//this.mapRewardIdHard = proRole.RoleBattle.RewardMapIdHard
+		//this.mapRewardLevelHard = proRole.RoleBattle.RewardMapLevelHard
 		this.mapLevelTime = proRole.RoleBattle.MapLevelTime
 		this.lastRecordBattleAcceTime = proRole.RoleBattle.LastRecordBattleAcceTime
 		this.battleAcceDuration = proRole.RoleBattle.BattleAcceDuration
@@ -338,21 +338,21 @@ func (this *RoleBattle) Load(msg interface{}) bool {
 			this.mapId = 1
 			this.SetDirty(true)
 		}
-		if this.mapRewardId == 0 || this.mapRewardLevel == 0 {
-			this.mapRewardId = 1
-			this.mapRewardLevel = 1
-			this.SetDirty(true)
-		}
+		//if this.mapRewardId == 0 || this.mapRewardLevel == 0 {
+		//	this.mapRewardId = 1
+		//	this.mapRewardLevel = 1
+		//	this.SetDirty(true)
+		//}
 		if this.mapLevelHard == 0 || this.mapIdHard == 0 {
 			this.mapLevelHard = 1
 			this.mapIdHard = 1
 			this.SetDirty(true)
 		}
-		if this.mapRewardIdHard == 0 || this.mapRewardLevelHard == 0 {
-			this.mapRewardIdHard = 1
-			this.mapRewardLevelHard = 1
-			this.SetDirty(true)
-		}
+		//if this.mapRewardIdHard == 0 || this.mapRewardLevelHard == 0 {
+		//	this.mapRewardIdHard = 1
+		//	this.mapRewardLevelHard = 1
+		//	this.SetDirty(true)
+		//}
 		this.getMapRewardShowCount()
 
 		this.quickBattle = &serverproto.QuickBattleData{}
@@ -485,6 +485,8 @@ func (this *RoleBattle) Save() {
 			RushMap:                  this.rushMap,
 			LastRecordBattleAcceTime: this.lastRecordBattleAcceTime,
 			BattleAcceDuration:       this.battleAcceDuration,
+			MapIdHard:                this.mapIdHard,
+			MapLevelHard:             this.mapLevelHard,
 			//todo...
 			//MapChallengeNumList: this.mapLevelChallengeNumList, 数据太大后续做优化处理
 		},
@@ -1056,8 +1058,11 @@ func (this *RoleBattle) BossReward(challengeTime uint32, mapId, mapLevel uint32,
 	//if ret != serverproto.ErrorCode_ERROR_OK {
 	//	return ret
 	//}
-
+	isHard := this.role.isHardFight
 	levelId := this.getLevelId(this.mapId, this.mapLevel)
+	if isHard {
+		levelId = this.getLevelId(this.mapIdHard, this.mapLevelHard)
+	}
 	levelCfgData, ok := serverproto.LevelCfgLoader[levelId]
 	if !ok {
 		return serverproto.ErrorCode_ERROR_BATTLE_LEVEL_DATA_NOT_FOUND
@@ -1108,28 +1113,39 @@ func (this *RoleBattle) BossReward(challengeTime uint32, mapId, mapLevel uint32,
 	_, ok1 := serverproto.LevelCfgLoader[levelId+1]
 	if !ok1 {
 		nextLevelId := this.getLevelId(this.mapId+1, 1)
+		if isHard {
+			nextLevelId = this.getLevelId(this.mapIdHard+1, 1)
+		}
 		_, ok2 := serverproto.LevelCfgLoader[nextLevelId]
 		if !ok2 {
 			util.WarnF("uid=%v BossReward next level cfg data not found!!!", this.role.GetUUid())
 		} else {
 			util.InfoF("uid=%v BossReward to next mapId=%v level=%v", this.role.GetUUid(), this.mapId+1, 1)
-			this.mapId++
-			this.mapLevel = 1
+			if isHard {
+				this.mapIdHard++
+				this.mapLevelHard = 1
+			} else {
+				this.mapId++
+				this.mapLevel = 1
+				//修改地图通关排名(需要通关该关卡)
+				this.addMapRank(1, oldMapId, oldMapLevel, challengeTime, recordTimeStamp)
+			}
 			this.mapLevelTime = nowTime
 			this.SetDirty(true)
-			//修改地图通关排名(需要通关该关卡)
-			this.addMapRank(1, oldMapId, oldMapLevel, challengeTime, recordTimeStamp)
 
 			this.changeBattleDataNtf()
 		}
 	} else {
-		this.mapLevel++
+		if isHard {
+			this.mapLevelHard++
+		} else {
+			this.mapLevel++
+			//修改地图通关排名(需要通关该关卡)
+			this.addMapRank(1, oldMapId, oldMapLevel, challengeTime, recordTimeStamp)
+		}
 		this.mapLevelTime = nowTime
 		this.SetDirty(true)
 
-		//修改地图通关排名(需要通关该关卡)
-		this.addMapRank(1, oldMapId, oldMapLevel, challengeTime, recordTimeStamp)
-
 		util.InfoF("uid=%v BossReward to next mapId=%v level=%v", this.role.GetUUid(), this.mapId, this.mapLevel)
 		this.changeBattleDataNtf()
 	}

+ 1 - 0
RO_Server_Trunk-branch_0.1.39/roserver/game/msg/login_msg.go

@@ -65,6 +65,7 @@ func init() {
 		role.SetPlatform(msg.Platform)
 		role.SetClientIP(msg.Ip)
 		role.SetSelectZone(msg.SelectZone) //客户端登陆时选择的服务器zone
+		role.SetHardFight(false)
 
 		//利用缓存数据
 		if bHas {

+ 1 - 1
RO_Server_Trunk-branch_0.1.39/roserver/game/msg/role_msg.go

@@ -1114,9 +1114,9 @@ func init() {
 			}
 			role.SetHardFight(false)
 		}
-		role.(*model2.Role).GetRoleBattle().SendBattleData()
 		util.InfoF("uid=%v cliId=%v receive CSMapLevelTypeChangeReq msg=%v", role.GetUUid(), cliId, msg)
 		role.ReplayGate(ackMsg, true)
+		role.(*model2.Role).GetRoleBattle().SendBattleData()
 	})
 
 	//来自db的地图挑战排名更新(自身调整更新排名)