public void processEvent(EventObject eventObject) { if (eventObject.getEventType() == (int)EventTypes.MonsterDead) { MonsterDeadEventObject obj = eventObject as MonsterDeadEventObject; Monster monster = obj.getMonster(); GameClient client = obj.getAttacker(); MonsterDead(client, monster); } if (eventObject.getEventType() == (int)EventTypes.MonsterToMonsterDead) { MonsterToMonsterDeadEventObject obj = eventObject as MonsterToMonsterDeadEventObject; Monster attack = obj.getMonsterAttack(); Monster monster = obj.getMonster(); CreateMonsterTagInfo tagInfo = monster.Tag as CreateMonsterTagInfo; if (monster != null && attack != null && monster.UniqueID != attack.UniqueID && tagInfo.ManagerType == (int)SceneUIClasses.CopyWolf) { FortDead(monster); } else if (monster != null && attack != null && monster.UniqueID == attack.UniqueID) { MonsterDead(monster); } } }
public void FortDead(Monster fortMonster) { CreateMonsterTagInfo tagInfo = fortMonster.Tag as CreateMonsterTagInfo; if (tagInfo != null) { int fubebSeqID = tagInfo.FuBenSeqId; if (fubebSeqID >= 0 && fortMonster.CopyMapID >= 0 && this.IsCopyWolf(fortMonster.CurrentMapCode)) { CopyWolfSceneInfo scene = null; if (this._runtimeData.SceneDict.TryGetValue(fubebSeqID, out scene) && scene != null) { if (scene.SceneStatus < GameSceneStatuses.STATUS_END) { lock (scene) { scene.SceneStatus = GameSceneStatuses.STATUS_END; scene.ScoreData.FortLifeNow = 0; GameManager.ClientMgr.BroadSpecialCopyMapMessage <CopyWolfScoreData>(1025, scene.ScoreData, scene.CopyMapInfo); } } } } } }
public void FortDead(Monster fortMonster) { CreateMonsterTagInfo tagInfo = fortMonster.Tag as CreateMonsterTagInfo; if (tagInfo == null) { return; } int fubebSeqID = tagInfo.FuBenSeqId; if (fubebSeqID < 0 || fortMonster.CopyMapID < 0 || !IsCopyWolf(fortMonster.CurrentMapCode)) { return; } CopyWolfSceneInfo scene = null; if (!_runtimeData.SceneDict.TryGetValue(fubebSeqID, out scene) || scene == null) { return; } if (scene.SceneStatus >= GameSceneStatuses.STATUS_END) { return; } lock (scene) { scene.SceneStatus = GameSceneStatuses.STATUS_END; scene.ScoreData.FortLifeNow = 0; GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_COPY_WOLF_SCORE_INFO, scene.ScoreData, scene.CopyMapInfo); }//lock }
public void processEvent(EventObject eventObject) { if (eventObject.getEventType() == 11) { MonsterDeadEventObject obj = eventObject as MonsterDeadEventObject; Monster monster = obj.getMonster(); GameClient client = obj.getAttacker(); this.MonsterDead(client, monster); } if (eventObject.getEventType() == 35) { MonsterToMonsterDeadEventObject obj2 = eventObject as MonsterToMonsterDeadEventObject; Monster attack = obj2.getMonsterAttack(); Monster monster = obj2.getMonster(); CreateMonsterTagInfo tagInfo = monster.Tag as CreateMonsterTagInfo; if (monster != null && attack != null && tagInfo != null && monster.UniqueID != attack.UniqueID && tagInfo.ManagerType == 34) { this.FortDead(monster); } else if (monster != null && attack != null && monster.UniqueID == attack.UniqueID) { this.MonsterDead(monster); } } }
public void MonsterDead(Monster monster) { CreateMonsterTagInfo tagInfo = monster.Tag as CreateMonsterTagInfo; if (tagInfo == null) { return; } int fubebSeqID = tagInfo.FuBenSeqId; if (fubebSeqID < 0 || monster.CopyMapID < 0 || !IsCopyWolf(monster.CurrentMapCode)) { return; } CopyWolfSceneInfo scene = null; if (!_runtimeData.SceneDict.TryGetValue(fubebSeqID, out scene) || scene == null) { return; } if (scene.SceneStatus >= GameSceneStatuses.STATUS_END) { return; } //如果是重复记录击杀同一只怪,则直接返回 if (!scene.AddKilledMonster(monster)) { return; } if (scene.SceneStatus >= GameSceneStatuses.STATUS_END) { return; } lock (scene) { if (scene.IsMonsterFlag == 1 && scene.KilledMonsterHashSet.Count == scene.MonsterCountCreate) { scene.MonsterWaveOld = scene.MonsterWave; if (scene.MonsterWave >= scene.MonsterWaveTotal) { scene.SceneStatus = GameSceneStatuses.STATUS_END; } else { scene.IsMonsterFlag = 0; } } }//lock }
public void processEvent(EventObjectEx eventObject) { if (eventObject.EventType == 30) { OnCreateMonsterEventObject e = eventObject as OnCreateMonsterEventObject; if (null != e) { CreateMonsterTagInfo tagInfo = e.Monster.Tag as CreateMonsterTagInfo; if (null != tagInfo) { e.Monster.AllwaySearchEnemy = true; if (tagInfo.IsFort) { e.Monster.Camp = this._runtimeData.CampID; } e.Result = true; e.Handled = true; } } } if (eventObject.EventType == 33) { PreMonsterInjureEventObject obj = eventObject as PreMonsterInjureEventObject; if (obj != null && obj.SceneType == 34) { Monster attacker = obj.Attacker as Monster; Monster fortMonster = obj.Monster; if (attacker != null && fortMonster != null) { CreateMonsterTagInfo tagInfo = fortMonster.Tag as CreateMonsterTagInfo; if (tagInfo != null && tagInfo.IsFort) { int fubebSeqID = tagInfo.FuBenSeqId; if (fubebSeqID > 0) { CopyWolfSceneInfo scene = null; if (this._runtimeData.SceneDict.TryGetValue(fubebSeqID, out scene) && scene != null) { int injure = this._runtimeData.GetMonsterHurt(attacker.MonsterInfo.ExtensionID); int fortLife = (int)Math.Max(0.0, fortMonster.VLife - (double)injure); scene.ScoreData.FortLifeNow = fortLife; scene.ScoreData.FortLifeMax = (int)fortMonster.MonsterInfo.VLifeMax; GameManager.ClientMgr.BroadSpecialCopyMapMessage <CopyWolfScoreData>(1025, scene.ScoreData, scene.CopyMapInfo); obj.Injure = injure; eventObject.Handled = true; eventObject.Result = true; } } } } } } }
/// <summary> /// 刷要塞 /// </summary> public void CreateFort(CopyWolfSceneInfo scene) { CopyMap copyMap = scene.CopyMapInfo; CopyWolfWaveInfo waveConfig = null; GameMap gameMap = null; if (!GameManager.MapMgr.DictMaps.TryGetValue(scene.MapID, out gameMap)) { LogManager.WriteLog(LogTypes.Error, string.Format("【狼魂要塞】报错 地图配置 ID = {0}", scene.MapID)); return; } lock (scene) { if (scene.IsFortFlag > 0) { return; } //置刷怪标记 scene.IsFortFlag = 1; int gridX = gameMap.CorrectWidthPointToGridPoint((int)_runtimeData.FortSite.X) / gameMap.MapGridWidth; int gridY = gameMap.CorrectHeightPointToGridPoint((int)_runtimeData.FortSite.Y) / gameMap.MapGridHeight; CreateMonsterTagInfo tagInfo = new CreateMonsterTagInfo(); tagInfo.FuBenSeqId = scene.FuBenSeqId; tagInfo.IsFort = true; tagInfo.ManagerType = (int)SceneUIClasses.CopyWolf; GameManager.MonsterZoneMgr.AddDynamicMonsters(scene.MapID, _runtimeData.FortMonsterID, scene.CopyMapInfo.CopyMapID, 1, gridX, gridY, 0, 0, SceneUIClasses.CopyWolf, tagInfo); XElement xml = GameManager.MonsterZoneMgr.AllMonstersXml; if (xml == null) { return; } XElement monsterXml = Global.GetSafeXElement(xml, "Monster", "ID", _runtimeData.FortMonsterID.ToString()); if (monsterXml == null) { return; } int life = (int)Global.GetSafeAttributeLong(monsterXml, "MaxLife"); scene.ScoreData.FortLifeNow = life; scene.ScoreData.FortLifeMax = life; GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_COPY_WOLF_SCORE_INFO, scene.ScoreData, scene.CopyMapInfo); } }
public void MonsterDead(Monster monster) { CreateMonsterTagInfo tagInfo = monster.Tag as CreateMonsterTagInfo; if (tagInfo != null) { int fubebSeqID = tagInfo.FuBenSeqId; if (fubebSeqID >= 0 && monster.CopyMapID >= 0 && this.IsCopyWolf(monster.CurrentMapCode)) { CopyWolfSceneInfo scene = null; if (this._runtimeData.SceneDict.TryGetValue(fubebSeqID, out scene) && scene != null) { if (scene.SceneStatus < GameSceneStatuses.STATUS_END) { if (scene.AddKilledMonster(monster)) { if (scene.SceneStatus < GameSceneStatuses.STATUS_END) { lock (scene) { if (scene.IsMonsterFlag == 1 && scene.KilledMonsterHashSet.Count == scene.MonsterCountCreate) { scene.MonsterWaveOld = scene.MonsterWave; if (scene.MonsterWave >= scene.MonsterWaveTotal) { scene.SceneStatus = GameSceneStatuses.STATUS_END; } else { scene.IsMonsterFlag = 0; } } } } } } } } } }
public void CreateFort(CopyWolfSceneInfo scene) { CopyMap copyMap = scene.CopyMapInfo; GameMap gameMap = null; if (!GameManager.MapMgr.DictMaps.TryGetValue(scene.MapID, out gameMap)) { LogManager.WriteLog(LogTypes.Error, string.Format("【狼魂要塞】报错 地图配置 ID = {0}", scene.MapID), null, true); } else { lock (scene) { if (scene.IsFortFlag <= 0) { scene.IsFortFlag = 1; int gridX = gameMap.CorrectWidthPointToGridPoint((int)this._runtimeData.FortSite.X) / gameMap.MapGridWidth; int gridY = gameMap.CorrectHeightPointToGridPoint((int)this._runtimeData.FortSite.Y) / gameMap.MapGridHeight; CreateMonsterTagInfo tagInfo = new CreateMonsterTagInfo(); tagInfo.FuBenSeqId = scene.FuBenSeqId; tagInfo.IsFort = true; tagInfo.ManagerType = 34; GameManager.MonsterZoneMgr.AddDynamicMonsters(scene.MapID, this._runtimeData.FortMonsterID, scene.CopyMapInfo.CopyMapID, 1, gridX, gridY, 0, 0, SceneUIClasses.CopyWolf, tagInfo, null); XElement xml = GameManager.MonsterZoneMgr.AllMonstersXml; if (xml != null) { XElement monsterXml = Global.GetSafeXElement(xml, "Monster", "ID", this._runtimeData.FortMonsterID.ToString()); if (monsterXml != null) { int life = (int)Global.GetSafeAttributeLong(monsterXml, "MaxLife"); scene.ScoreData.FortLifeNow = life; scene.ScoreData.FortLifeMax = life; GameManager.ClientMgr.BroadSpecialCopyMapMessage <CopyWolfScoreData>(1025, scene.ScoreData, scene.CopyMapInfo); } } } } } }
/// <summary> /// 刷怪 /// </summary> public void CreateMonster(CopyWolfSceneInfo scene, int upWave = 1) { CopyMap copyMap = scene.CopyMapInfo; CopyWolfWaveInfo waveConfig = null; GameMap gameMap = null; if (!GameManager.MapMgr.DictMaps.TryGetValue(scene.MapID, out gameMap)) { LogManager.WriteLog(LogTypes.Error, string.Format("【狼魂要塞】报错 地图配置 ID = {0}", scene.MapID)); return; } //------------------------------------临时测试 //if (scene.MonsterWave > 0) //{ // //置刷怪标记 // scene.IsMonsterFlag = 1; // return; //} long nowTicket = TimeUtil.NOW(); long nowSecond = nowTicket / 1000; lock (scene) { if (scene.MonsterWave >= scene.MonsterWaveTotal) { scene.MonsterWaveOld = scene.MonsterWave; scene.MonsterWave = 0; scene.SceneStatus = GameSceneStatuses.STATUS_END; return; } //置刷怪标记 scene.IsMonsterFlag = 1; int wave = scene.MonsterWave + upWave; if (wave > scene.MonsterWaveTotal) { wave = scene.MonsterWaveTotal; } waveConfig = _runtimeData.GetWaveConfig(wave); if (waveConfig == null) { LogManager.WriteLog(LogTypes.Error, string.Format("【狼魂要塞】报错 刷怪波次 = {0}", wave)); return; } scene.MonsterWave = wave; // 递增刷怪波数 scene.CreateMonsterTime = nowSecond; int totalCount = 0; int monsterID = 0; int monsterCount = 0; int gridX = 0; int gridY = 0; int gridNum = 0; CreateMonsterTagInfo tagInfo = new CreateMonsterTagInfo(); tagInfo.FuBenSeqId = scene.FuBenSeqId; tagInfo.IsFort = false; tagInfo.ManagerType = (int)SceneUIClasses.CopyWolf; foreach (CopyWolfSiteInfo siteInfo in waveConfig.MonsterSiteDic) { gridX = gameMap.CorrectWidthPointToGridPoint(siteInfo.X + Global.GetRandomNumber(-siteInfo.Radius, siteInfo.Radius)) / gameMap.MapGridWidth; gridY = gameMap.CorrectHeightPointToGridPoint(siteInfo.Y + Global.GetRandomNumber(-siteInfo.Radius, siteInfo.Radius)) / gameMap.MapGridHeight; foreach (var monster in waveConfig.MonsterList) { monsterID = monster[0]; monsterCount = monster[1]; totalCount += monsterCount; GameManager.MonsterZoneMgr.AddDynamicMonsters(scene.MapID, monsterID, scene.CopyMapInfo.CopyMapID, monsterCount, gridX, gridY, gridNum, 0, SceneUIClasses.CopyWolf, tagInfo); //break; } //break; } scene.MonsterCountCreate += totalCount; scene.ScoreData.Wave = waveConfig.WaveID; scene.ScoreData.EndTime = nowTicket + waveConfig.NextTime * 1000; //scene.ScoreData.MonsterCount += scene.MonsterCountCreate; GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_COPY_WOLF_SCORE_INFO, scene.ScoreData, scene.CopyMapInfo); } }
public void processEvent(EventObjectEx eventObject) { if (eventObject.EventType == (int)EventTypes.OnCreateMonster) { OnCreateMonsterEventObject e = eventObject as OnCreateMonsterEventObject; if (null != e) { CreateMonsterTagInfo tagInfo = e.Monster.Tag as CreateMonsterTagInfo; if (null != tagInfo) { e.Monster.AllwaySearchEnemy = true; if (tagInfo.IsFort) { e.Monster.Camp = _runtimeData.CampID; } e.Result = true; e.Handled = true; } } } if (eventObject.EventType == (int)EventTypes.PreMonsterInjure) { PreMonsterInjureEventObject obj = eventObject as PreMonsterInjureEventObject; if (obj != null && obj.SceneType == (int)SceneUIClasses.CopyWolf) { Monster attacker = obj.Attacker as Monster; Monster fortMonster = obj.Monster; if (attacker == null || fortMonster == null) { return; } CreateMonsterTagInfo tagInfo = fortMonster.Tag as CreateMonsterTagInfo; if (tagInfo != null) { int fubebSeqID = tagInfo.FuBenSeqId; //int.TryParse(fortMonster.Tag.ToString(), out fubebSeqID); if (fubebSeqID <= 0) { return; } CopyWolfSceneInfo scene = null; if (!_runtimeData.SceneDict.TryGetValue(fubebSeqID, out scene) || scene == null) { return; } //====Monsters=== //int injure = _runtimeData.GetMonsterHurt(attacker.MonsterInfo.ExtensionID); ////injure = 1; //int fortLife = (int)Math.Max(0, fortMonster.VLife - injure); //scene.ScoreData.FortLifeNow = fortLife; //scene.ScoreData.FortLifeMax = (int)fortMonster.MonsterInfo.VLifeMax; //GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_COPY_WOLF_SCORE_INFO, scene.ScoreData, scene.CopyMapInfo); // obj.Injure = injure; eventObject.Handled = true; eventObject.Result = true; } } } }
public void CreateMonster(CopyWolfSceneInfo scene, int upWave = 1) { CopyMap copyMap = scene.CopyMapInfo; CopyWolfWaveInfo waveConfig = null; GameMap gameMap = null; if (!GameManager.MapMgr.DictMaps.TryGetValue(scene.MapID, out gameMap)) { LogManager.WriteLog(LogTypes.Error, string.Format("【狼魂要塞】报错 地图配置 ID = {0}", scene.MapID), null, true); } else { long nowTicket = TimeUtil.NOW(); long nowSecond = nowTicket / 1000L; lock (scene) { if (scene.MonsterWave >= scene.MonsterWaveTotal) { scene.MonsterWaveOld = scene.MonsterWave; scene.MonsterWave = 0; scene.SceneStatus = GameSceneStatuses.STATUS_END; } else { scene.IsMonsterFlag = 1; int wave = scene.MonsterWave + upWave; if (wave > scene.MonsterWaveTotal) { wave = scene.MonsterWaveTotal; } waveConfig = this._runtimeData.GetWaveConfig(wave); if (waveConfig == null) { LogManager.WriteLog(LogTypes.Error, string.Format("【狼魂要塞】报错 刷怪波次 = {0}", wave), null, true); } else { scene.MonsterWave = wave; scene.CreateMonsterTime = nowSecond; int totalCount = 0; int gridNum = 0; CreateMonsterTagInfo tagInfo = new CreateMonsterTagInfo(); tagInfo.FuBenSeqId = scene.FuBenSeqId; tagInfo.IsFort = false; tagInfo.ManagerType = 34; foreach (CopyWolfSiteInfo siteInfo in waveConfig.MonsterSiteDic) { int gridX = gameMap.CorrectWidthPointToGridPoint(siteInfo.X + Global.GetRandomNumber(-siteInfo.Radius, siteInfo.Radius)) / gameMap.MapGridWidth; int gridY = gameMap.CorrectHeightPointToGridPoint(siteInfo.Y + Global.GetRandomNumber(-siteInfo.Radius, siteInfo.Radius)) / gameMap.MapGridHeight; foreach (int[] monster in waveConfig.MonsterList) { int monsterID = monster[0]; int monsterCount = monster[1]; totalCount += monsterCount; GameManager.MonsterZoneMgr.AddDynamicMonsters(scene.MapID, monsterID, scene.CopyMapInfo.CopyMapID, monsterCount, gridX, gridY, gridNum, 0, SceneUIClasses.CopyWolf, tagInfo, null); } } scene.MonsterCountCreate += totalCount; scene.ScoreData.Wave = waveConfig.WaveID; scene.ScoreData.EndTime = nowTicket + (long)(waveConfig.NextTime * 1000); GameManager.ClientMgr.BroadSpecialCopyMapMessage <CopyWolfScoreData>(1025, scene.ScoreData, scene.CopyMapInfo); } } } } }