public void AddCopyScene(GameClient client, CopyMap copyMap, SceneUIClasses sceneType) { if (copyMap.MapCode == this.MapCode) { int fuBenSeqId = copyMap.FuBenSeqID; int mapCode = copyMap.MapCode; lock (this.copyDict) { MoRiJudgeCopy copy = null; if (!this.copyDict.TryGetValue(fuBenSeqId, out copy)) { copy = new MoRiJudgeCopy(); copy.MyCopyMap = copyMap; copy.GameId = Global.GetClientKuaFuServerLoginData(client).GameId; copy.StateTimeData.GameType = 3; copy.StartTime = TimeUtil.NowDateTime(); copy.EndTime = copy.StartTime.AddMinutes((double)this.CopyMaxAliveMinutes); copy.LimitKillCount = 0; copy.RoleCount = 1; copy.Passed = false; this.copyDict[fuBenSeqId] = copy; } else { copy.RoleCount++; } } FuBenManager.AddFuBenSeqID(client.ClientData.RoleID, copyMap.FuBenSeqID, 0, copyMap.FubenMapID); copyMap.IsKuaFuCopy = true; copyMap.SetRemoveTicks(TimeUtil.NOW() + (long)((this.CopyMaxAliveMinutes + 3) * 60000)); GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 1, 0, 0, 3); } }
public void OnLoadDynamicMonsters(Monster monster) { MoRiMonsterTag tag = null; if (monster != null && (tag = (monster.Tag as MoRiMonsterTag)) != null) { MoRiJudgeCopy judgeCopy = null; lock (this.copyDict) { if (!this.copyDict.TryGetValue(tag.CopySeqId, out judgeCopy)) { return; } } GameManager.ClientMgr.BroadSpecialCopyMapMessageStr(1305, string.Format("{0}:{1}:{2}:{3}", new object[] { 1, this.BossConfigList[tag.MonsterIdx].Id, judgeCopy.MonsterList[tag.MonsterIdx].BirthMs, judgeCopy.MonsterList[tag.MonsterIdx].DeathMs }), judgeCopy.MyCopyMap, false); long toTick = TimeUtil.NowDateTime().Ticks + 36000000000L; if (tag.ExtPropDict != null) { foreach (KeyValuePair <int, float> kvp in tag.ExtPropDict) { monster.TempPropsBuffer.AddTempExtProp(kvp.Key, (double)kvp.Value, toTick); } } } }
public void OnLogOut(GameClient client) { // MoRiJudgeClient.getInstance().GameFuBenRoleChangeState(client.ClientData.RoleID, (int)KuaFuRoleStates.None); MoRiJudgeCopy judgeCopy = null; lock (copyDict) { if (!copyDict.TryGetValue(client.ClientData.FuBenSeqID, out judgeCopy)) { return; } } lock (judgeCopy) { judgeCopy.RoleCount--; if (judgeCopy.m_eStatus != GameSceneStatuses.STATUS_END && judgeCopy.m_eStatus != GameSceneStatuses.STATUS_AWARD && judgeCopy.m_eStatus != GameSceneStatuses.STATUS_CLEAR) { KuaFuManager.getInstance().SetCannotJoinKuaFu_UseAutoEndTicks(client); } } }
public void OnLoadDynamicMonsters(Monster monster) { MoRiMonsterTag tag = null; if (monster == null || (tag = monster.Tag as MoRiMonsterTag) == null) { return; } MoRiJudgeCopy judgeCopy = null; lock (copyDict) { if (!copyDict.TryGetValue(tag.CopySeqId, out judgeCopy)) { return; } } // 通知怪物出生 GameManager.ClientMgr.BroadSpecialCopyMapMessageStr((int)TCPGameServerCmds.CMD_NTF_MORI_MONSTER_EVENT, string.Format("{0}:{1}:{2}:{3}", (int)MoRiMonsterEvent.Birth, BossConfigList[tag.MonsterIdx].Id, judgeCopy.MonsterList[tag.MonsterIdx].BirthMs, judgeCopy.MonsterList[tag.MonsterIdx].DeathMs), judgeCopy.MyCopyMap); // 增强临时属性,副本时间只有15分钟,只有就暂时加1个小时吧,因为是永久加成的 long toTick = TimeUtil.NowDateTime().Ticks + 3600L * 1000 * 10000; if (tag.ExtPropDict != null) { foreach (var kvp in tag.ExtPropDict) { monster.TempPropsBuffer.AddTempExtProp(kvp.Key, kvp.Value, toTick); } } }
public double GetCopyAwardRate(int copySeqId) { MoRiJudgeCopy judgeCopy = null; lock (this.copyDict) { if (!this.copyDict.TryGetValue(copySeqId, out judgeCopy)) { return(1.0); } } return(this.CalcAwardRate(judgeCopy)); }
private void FlushMonster(MoRiJudgeCopy judgeCopy, int nextMonsterIdx) { MoRiMonsterTag tag = new MoRiMonsterTag(); tag.CopySeqId = judgeCopy.MyCopyMap.FuBenSeqID; tag.MonsterIdx = nextMonsterIdx; tag.ExtPropDict = null; // 刷怪 if (nextMonsterIdx == BossConfigList.Count - 1) { tag.ExtPropDict = new Dictionary <int, float>(); // 刷boss for (int i = 0; i < judgeCopy.MonsterList.Count && i < judgeCopy.CurrMonsterIdx; ++i) { if (BossConfigList[i].KillLimitSecond != -1 && (judgeCopy.MonsterList[i].DeathMs - judgeCopy.MonsterList[i].BirthMs) <= BossConfigList[i].KillLimitSecond * 1000L) { // 完成了限时击杀,需要给boss加成 foreach (var kvp in BossConfigList[i].ExtPropDict) { if (tag.ExtPropDict.ContainsKey(kvp.Key)) { tag.ExtPropDict[kvp.Key] += kvp.Value; } else { tag.ExtPropDict.Add(kvp.Key, kvp.Value); } } } } } GameManager.MonsterZoneMgr.AddDynamicMonsters(this.MapCode, BossConfigList[nextMonsterIdx].MonsterId, judgeCopy.MyCopyMap.CopyMapID, 1, BossConfigList[nextMonsterIdx].BirthX / copyMapGirdWidth, BossConfigList[nextMonsterIdx].BirthY / copyMapGirdHeight, 0, 0, SceneUIClasses.MoRiJudge, tag); judgeCopy.MonsterList.Add(new MoRiMonsterData() { Id = BossConfigList[nextMonsterIdx].Id, BirthMs = TimeUtil.NOW(), DeathMs = -1 }); judgeCopy.CurrMonsterIdx = nextMonsterIdx; }
public void processEvent(EventObject eventObject) { if (eventObject.getEventType() == 11) { MonsterDeadEventObject deadEv = eventObject as MonsterDeadEventObject; if (deadEv.getAttacker().ClientData.CopyMapID > 0 && deadEv.getAttacker().ClientData.FuBenSeqID > 0 && deadEv.getAttacker().ClientData.MapCode == this.MapCode && deadEv.getMonster().CurrentMapCode == this.MapCode) { MoRiMonsterTag tag = deadEv.getMonster().Tag as MoRiMonsterTag; if (tag != null) { MoRiJudgeCopy judgeCopy = null; lock (this.copyDict) { if (!this.copyDict.TryGetValue(tag.CopySeqId, out judgeCopy)) { return; } } lock (judgeCopy) { if (judgeCopy.m_eStatus == GameSceneStatuses.STATUS_BEGIN) { if (judgeCopy.MonsterList[tag.MonsterIdx].DeathMs <= 0L) { judgeCopy.MonsterList[tag.MonsterIdx].DeathMs = TimeUtil.NOW(); GameManager.ClientMgr.BroadSpecialCopyMapMessageStr(1305, string.Format("{0}:{1}:{2}:{3}", new object[] { 2, this.BossConfigList[tag.MonsterIdx].Id, judgeCopy.MonsterList[tag.MonsterIdx].BirthMs, judgeCopy.MonsterList[tag.MonsterIdx].DeathMs }), judgeCopy.MyCopyMap, false); this.CalcAwardRate(judgeCopy); if (judgeCopy.MonsterList.Count == this.BossConfigList.Count) { judgeCopy.Passed = true; judgeCopy.m_eStatus = GameSceneStatuses.STATUS_END; } } } } } } } }
private double CalcAwardRate(MoRiJudgeCopy judgeCopy) { double result = 1.0; judgeCopy.LimitKillCount = 0; for (int i = 0; i < judgeCopy.MonsterList.Count; i++) { if (judgeCopy.MonsterList[i].DeathMs > 0L && this.BossConfigList[i].KillLimitSecond > 0 && judgeCopy.MonsterList[i].DeathMs - judgeCopy.MonsterList[i].BirthMs <= (long)(this.BossConfigList[i].KillLimitSecond * 1000)) { judgeCopy.LimitKillCount++; } } if (this.AwardFactor != null && judgeCopy.LimitKillCount - 1 >= 0 && judgeCopy.LimitKillCount - 1 < this.AwardFactor.Length) { result = this.AwardFactor[judgeCopy.LimitKillCount - 1]; } return(result); }
// 添加一个末日审判副本 public void AddCopyScene(GameClient client, CopyMap copyMap, SceneUIClasses sceneType) { if (copyMap.MapCode == this.MapCode) { int fuBenSeqId = copyMap.FuBenSeqID; int mapCode = copyMap.MapCode; lock (copyDict) { MoRiJudgeCopy copy = null; if (!copyDict.TryGetValue(fuBenSeqId, out copy)) { copy = new MoRiJudgeCopy(); copy.MyCopyMap = copyMap; copy.GameId = Global.GetClientKuaFuServerLoginData(client).GameId; copy.StateTimeData.GameType = (int)GameTypes.MoRiJudge; // 副本的统计信息 copy.StartTime = TimeUtil.NowDateTime(); copy.EndTime = copy.StartTime.AddMinutes(this.CopyMaxAliveMinutes); copy.LimitKillCount = 0; copy.RoleCount = 1; copy.Passed = false; copyDict[fuBenSeqId] = copy; } else { copy.RoleCount++; } } FuBenManager.AddFuBenSeqID(client.ClientData.RoleID, copyMap.FuBenSeqID, 0, copyMap.FubenMapID); copyMap.IsKuaFuCopy = true; // 增加清除时间 copyMap.SetRemoveTicks(TimeUtil.NOW() + (this.CopyMaxAliveMinutes + 3) * TimeUtil.MINITE); //更新状态 // MoRiJudgeClient.getInstance().GameFuBenRoleChangeState(client.ClientData.RoleID, (int)KuaFuRoleStates.StartGame); // 开始游戏统计 GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 1, 0, 0, (int)GameTypes.MoRiJudge); } }
private void FlushMonster(MoRiJudgeCopy judgeCopy, int nextMonsterIdx) { MoRiMonsterTag tag = new MoRiMonsterTag(); tag.CopySeqId = judgeCopy.MyCopyMap.FuBenSeqID; tag.MonsterIdx = nextMonsterIdx; tag.ExtPropDict = null; if (nextMonsterIdx == this.BossConfigList.Count - 1) { tag.ExtPropDict = new Dictionary <int, float>(); int i = 0; while (i < judgeCopy.MonsterList.Count && i < judgeCopy.CurrMonsterIdx) { if (this.BossConfigList[i].KillLimitSecond != -1 && judgeCopy.MonsterList[i].DeathMs - judgeCopy.MonsterList[i].BirthMs <= (long)this.BossConfigList[i].KillLimitSecond * 1000L) { foreach (KeyValuePair <int, float> kvp in this.BossConfigList[i].ExtPropDict) { if (tag.ExtPropDict.ContainsKey(kvp.Key)) { Dictionary <int, float> extPropDict; int key; (extPropDict = tag.ExtPropDict)[key = kvp.Key] = extPropDict[key] + kvp.Value; } else { tag.ExtPropDict.Add(kvp.Key, kvp.Value); } } } i++; } } GameManager.MonsterZoneMgr.AddDynamicMonsters(this.MapCode, this.BossConfigList[nextMonsterIdx].MonsterId, judgeCopy.MyCopyMap.CopyMapID, 1, this.BossConfigList[nextMonsterIdx].BirthX / this.copyMapGirdWidth, this.BossConfigList[nextMonsterIdx].BirthY / this.copyMapGirdHeight, 0, 0, SceneUIClasses.MoRiJudge, tag, null); judgeCopy.MonsterList.Add(new MoRiMonsterData { Id = this.BossConfigList[nextMonsterIdx].Id, BirthMs = TimeUtil.NOW(), DeathMs = -1L }); judgeCopy.CurrMonsterIdx = nextMonsterIdx; }
public void DelCopyScene(CopyMap copyMap) { if (copyMap != null && copyMap.MapCode == this.MapCode) { MoRiJudgeCopy judgeCopy = null; lock (this.copyDict) { if (!this.copyDict.TryGetValue(copyMap.FuBenSeqID, out judgeCopy)) { return; } } lock (judgeCopy) { if (judgeCopy.m_eStatus < GameSceneStatuses.STATUS_END) { judgeCopy.m_eStatus = GameSceneStatuses.STATUS_END; } } } }
public void NotifyTimeStateAndBossEvent(GameClient client) { MoRiJudgeCopy judgeCopy = null; lock (this.copyDict) { if (!this.copyDict.TryGetValue(client.ClientData.FuBenSeqID, out judgeCopy)) { return; } } lock (judgeCopy) { client.sendCmd <GameSceneStateTimeData>(827, judgeCopy.StateTimeData, false); foreach (MoRiMonsterData boss in judgeCopy.MonsterList) { if (boss.BirthMs > 0L) { GameManager.ClientMgr.BroadSpecialCopyMapMessageStr(1305, string.Format("{0}:{1}:{2}:{3}", new object[] { 1, boss.Id, boss.BirthMs, boss.DeathMs }), judgeCopy.MyCopyMap, false); } if (boss.DeathMs > 0L) { GameManager.ClientMgr.BroadSpecialCopyMapMessageStr(1305, string.Format("{0}:{1}:{2}:{3}", new object[] { 2, boss.Id, boss.BirthMs, boss.DeathMs }), judgeCopy.MyCopyMap, false); } } } }
private double CalcAwardRate(MoRiJudgeCopy judgeCopy) { double result = 1.0; judgeCopy.LimitKillCount = 0; for (int i = 0; i < judgeCopy.MonsterList.Count; ++i) { if (judgeCopy.MonsterList[i].DeathMs > 0 && BossConfigList[i].KillLimitSecond > 0 && judgeCopy.MonsterList[i].DeathMs - judgeCopy.MonsterList[i].BirthMs <= BossConfigList[i].KillLimitSecond * 1000) { ++judgeCopy.LimitKillCount; } } if (AwardFactor != null && judgeCopy.LimitKillCount - 1 >= 0 && judgeCopy.LimitKillCount - 1 < AwardFactor.Length) { result = AwardFactor[judgeCopy.LimitKillCount - 1]; } return(result); }
// 客户端进入地图 public void NotifyTimeStateAndBossEvent(GameClient client) { MoRiJudgeCopy judgeCopy = null; lock (copyDict) { if (!copyDict.TryGetValue(client.ClientData.FuBenSeqID, out judgeCopy)) { return; } } lock (judgeCopy) { client.sendCmd((int)TCPGameServerCmds.CMD_SPR_NOTIFY_TIME_STATE, judgeCopy.StateTimeData); foreach (var boss in judgeCopy.MonsterList) { if (boss.BirthMs > 0) { GameManager.ClientMgr.BroadSpecialCopyMapMessageStr( (int)TCPGameServerCmds.CMD_NTF_MORI_MONSTER_EVENT, string.Format("{0}:{1}:{2}:{3}", (int)MoRiMonsterEvent.Birth, boss.Id, boss.BirthMs, boss.DeathMs), judgeCopy.MyCopyMap); } if (boss.DeathMs > 0) { GameManager.ClientMgr.BroadSpecialCopyMapMessageStr( (int)TCPGameServerCmds.CMD_NTF_MORI_MONSTER_EVENT, string.Format("{0}:{1}:{2}:{3}", (int)MoRiMonsterEvent.Death, boss.Id, boss.BirthMs, boss.DeathMs), judgeCopy.MyCopyMap); } } } }
public void processEvent(EventObject eventObject) { if (eventObject.getEventType() == (int)EventTypes.MonsterDead) { MonsterDeadEventObject deadEv = eventObject as MonsterDeadEventObject; if (deadEv.getAttacker().ClientData.CopyMapID > 0 && deadEv.getAttacker().ClientData.FuBenSeqID > 0 && deadEv.getAttacker().ClientData.MapCode == this.MapCode && deadEv.getMonster().CurrentMapCode == this.MapCode ) { MoRiMonsterTag tag = deadEv.getMonster().Tag as MoRiMonsterTag; if (tag == null) { return; } MoRiJudgeCopy judgeCopy = null; lock (copyDict) { if (!copyDict.TryGetValue(tag.CopySeqId, out judgeCopy)) { return; } } long killMs = 0; lock (judgeCopy) { // 只有在战斗阶段的杀怪才有效 if (judgeCopy.m_eStatus != GameSceneStatuses.STATUS_BEGIN) { return; } // 只有一条命 if (judgeCopy.MonsterList[tag.MonsterIdx].DeathMs > 0) { return; } judgeCopy.MonsterList[tag.MonsterIdx].DeathMs = TimeUtil.NOW(); // 通知怪物死亡事件 GameManager.ClientMgr.BroadSpecialCopyMapMessageStr( (int)TCPGameServerCmds.CMD_NTF_MORI_MONSTER_EVENT, string.Format("{0}:{1}:{2}:{3}", (int)MoRiMonsterEvent.Death, BossConfigList[tag.MonsterIdx].Id, judgeCopy.MonsterList[tag.MonsterIdx].BirthMs, judgeCopy.MonsterList[tag.MonsterIdx].DeathMs), judgeCopy.MyCopyMap); CalcAwardRate(judgeCopy); /* * FuBenInfoItem fbItem = FuBenManager.FindFuBenInfoBySeqID(judgeCopy.MyCopyMap.FuBenSeqID); * if (fbItem != null) * { * fbItem.AwardRate += CalcAwardRate(judgeCopy); * }*/ if (judgeCopy.MonsterList.Count == BossConfigList.Count) { judgeCopy.Passed = true; judgeCopy.m_eStatus = GameSceneStatuses.STATUS_END; } } } } }